mm_os
Version:
这是超级美眉服务端框架,用于快速构建应用程序。
22 lines (21 loc) • 516 B
JavaScript
/**
* web请求
* @param {Object} server 服务
* @param {Object} config 配置参数
*/
module.exports = function(server, config) {
// 使用路由(主要)
server.use(async (ctx, next) => {
if (ctx.path !== "/favicon.ico") {
await $.eventer.run('web_main', ctx, ctx.db);
var event = $.event_admin('api');
var ret = await event.main(ctx.path, ctx, ctx.db);
// console.log("main阶段", ret);
if (ret) {
ctx.body = ret;
}
}
await next();
});
return server;
};