module.exports = function(app) 是什么意思?
what is the meaning of the module.exports = function(app)?
解释codes:All三行code.Please是什么意思
module.exports = function(app){
var x = express.router();
var y = express.router();
}
请告诉链接以了解这些内容,因为我在谷歌上搜索了很多并阅读了但我没有理解。
//Line 1
module.exports = function()
这一行表示这个文件已经导出为一个函数,你可以通过require('the-path-to-file.js')
访问它。
var func1 = require('the-path-to-file.js');
// call the function in other file
func1(app);
其他线路正在生成路由器,更多信息详见http://expressjs.com/en/guide/routing.html
解释codes:All三行code.Please是什么意思
module.exports = function(app){
var x = express.router();
var y = express.router();
}
请告诉链接以了解这些内容,因为我在谷歌上搜索了很多并阅读了但我没有理解。
//Line 1
module.exports = function()
这一行表示这个文件已经导出为一个函数,你可以通过require('the-path-to-file.js')
访问它。
var func1 = require('the-path-to-file.js');
// call the function in other file
func1(app);
其他线路正在生成路由器,更多信息详见http://expressjs.com/en/guide/routing.html