node.js - Express中的user.js是干嘛的?
高洛峰
高洛峰 2017-04-17 15:20:30
0
1
925

使用express -e hello
生成了一些文件,user.js是干嘛的,为啥和index.js几乎一样?views里面有模板是怎样对应其他文件的?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
Ty80

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template