数据库插件

This commit is contained in:
robin
2022-06-03 15:18:47 +08:00
parent 8150466cbd
commit ba9ca43729
25 changed files with 123 additions and 219 deletions
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
path:"app/*/api/*.js"
}
+13
View File
@@ -0,0 +1,13 @@
/**
* 加载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)
})
})
}