优化打包方法
This commit is contained in:
@@ -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("接口初始化完毕")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user