Commit 3420be83 authored by 方雄韬's avatar 方雄韬

update

parent 069a460d
......@@ -4,7 +4,7 @@
"description": "wechat minigrogram duiba credits mall demo",
"main": "app.js",
"scripts": {
"start": "node ./server/app.js",
"start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
......
/**
* 自动扫描加载路由
* 自动扫描加载控制器,配置路由。
*/
const fs = require('fs');
// process.cwd() 是当前执行node命令时候的文件夹地址
......@@ -23,14 +23,14 @@ function addMapping(router, mapping) {
}
function addControllers(router) {
var files = fs.readdirSync(cwd + '/server/controllers');
var files = fs.readdirSync(cwd + '/controllers');
var js_files = files.filter((f) => {
return f.endsWith('.js');
});
for (var f of js_files) {
console.log(`process controller: ${f}...`);
let mapping = require(cwd + '/server/controllers/' + f);
let mapping = require(cwd + '/controllers/' + f);
addMapping(router, mapping);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment