使用express -e hello
生成了一些文件,user.js是干嘛的,为啥和index.js几乎一样?views里面有模板是怎样对应其他文件的?
PHP中文网2017-04-17 15:22:30
user.js
contains routing rules, which can be seen from the following code of app.js
. user.js
and index.js
are both routing rules, so they look similar.
var routes = require('./routes/index');
var users = require('./routes/users');
app.use('/', routes);
app.use('/users', users);
Here are the study notes of express. Of course, I recommend the official documentation.