后端搭建起来

This commit is contained in:
aixianling
2022-12-30 16:03:32 +08:00
parent cf5f60a049
commit b8ac23dcfd
8 changed files with 85 additions and 38 deletions

View File

@@ -1,4 +1,11 @@
module.exports = (app) => {
const { router, controller } = app;
router.get('/', controller.home.index);
const {router, controller} = 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])
}
}
console.log("接口初始化完毕")
};