鉴权完成,并修复小程序接口拦截器问题

This commit is contained in:
aixianling
2023-01-13 17:57:46 +08:00
parent 9c26e09326
commit 5594dc2378
8 changed files with 107 additions and 16 deletions

View File

@@ -1,10 +1,11 @@
module.exports = (app) => {
const {router, controller} = app;
const {router, controller, jwt} = app;
console.log('启动接口...')
for (const file in controller) {
for (const item in controller[file]) {
console.log(`初始化接口:/${file}/${item}`)
router.post(`/api/${file}/${item}`, controller[file][item])
item == "token" ? router.post(`/api/${file}/${item}`, controller[file][item]) :
router.post(`/api/${file}/${item}`, jwt, controller[file][item])
}
}
console.log("接口初始化完毕")