UNPKG

mm_os

Version:

这是超级美眉服务端框架,用于快速构建应用程序。

28 lines (27 loc) 673 B
/** * web验证 * @param {Object} server 服务 * @param {Object} config 配置参数 */ module.exports = function(server, config) { // 使用路由(主要) server.use(async (ctx, next) => { try { if (ctx.path !== "/favicon.ico") { await $.eventer.run('web_check', ctx, ctx.db); var event = $.event_admin('api'); var ret = await event.check(ctx.path, ctx, ctx.db); // console.log("check阶段", ret); if (ret) { ctx.body = ret; } } await next(); } catch (error) { $.log.error('web_check中间件错误:', error); // 确保请求可以继续处理 await next(); } }); return server; };