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