/** * 加载api路由 * 加载app/api目录下的文件到路由 */ const config = require("./config") module.exports = async (app) => { let list = await app.load(config.path) list.forEach(item => { app.use(async (ctx, next) => { return await item.res.fun(ctx, next) }) }) }