优化打包方法

This commit is contained in:
aixianling
2023-01-18 12:08:51 +08:00
parent de3549d82e
commit 766faee96e
7 changed files with 124 additions and 14 deletions

View File

@@ -1,16 +1,16 @@
const {findFile} = require("../utils/fsUtils");
const chalk = require("chalk");
const log = console.log
module.exports = {
init: ins => {
return findFile('./src/rest', file => {
if (!/index\.js/.test(file)) {
let rest = require(file.replace(/src[\\\/]rest/, '.'))
console.log(`初始化接口:${rest.action}`)
log(`${chalk.bgBlue.black(" REST ")} ${rest.action}`)
if (rest.method == "post") {
ins.post(rest.action, (req, res) => rest.execute(req, res))
}
}
}).then(() => {
console.log("接口初始化完毕")
})
}
}