1 Star 0 Fork 22

core/O2O

forked from Gaubee/O2O 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
routerMap.js 793 Bytes
一键复制 编辑 原始数据 按行查看 历史
Gaubee 提交于 2014-05-29 16:26 +08:00 . 增加简单的风格包的功能
var myfs = require("./_include/fs");
var jslist = myfs.ls("server/RESTAPI");
RESTlist = jslist.filter(function(fileName){
var suffix = ".rest.js"
return fileName.toLowerCase().substr(-suffix.length) == suffix;
});
module.exports = function setRouter(app){
RESTlist.forEach(function(fileName){
var RESTModule = require("../"+fileName);
var prefix = RESTModule.prefix;
delete RESTModule.prefix;
var methodNames = Object.keys(RESTModule);
methodNames.forEach(function(methodName){
var methodSet = RESTModule[methodName];
Object.keys(methodSet).forEach(function(extendURL){
app.register(prefix+(extendURL==="/"?"":extendURL),[methodName],methodSet[extendURL]);
});
});
});
app.register("/gaubee",["get"],function *(next){
console.log("????");
yield next;
});
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
NodeJS
1
https://gitee.com/lehoon/O2O.git
git@gitee.com:lehoon/O2O.git
lehoon
O2O
O2O
master

搜索帮助