|
@@ -11,14 +11,14 @@ const _ = require('lodash');
|
|
|
module.exports = (app, routes, keyZh, rkey, ckey) => {
|
|
|
const { router, config } = app;
|
|
|
const mwares = app.middleware;
|
|
|
- if (process.env.NODE_ENV === 'development') console.log(`${keyZh}: ${rkey}`);
|
|
|
+ // if (process.env.NODE_ENV === 'development') console.log(`${keyZh}: ${rkey}`);
|
|
|
for (const route of routes) {
|
|
|
const { method, path, controller: ctl, zh } = route;
|
|
|
let { middleware = [] } = route;
|
|
|
if (!method || !path || !ctl) continue;
|
|
|
// 拼全路径
|
|
|
const allPath = `${config.routePrefix}/${path}`;
|
|
|
- if (process.env.NODE_ENV === 'development') console.log(` ${zh}: ${allPath}`);
|
|
|
+ // if (process.env.NODE_ENV === 'development') console.log(` ${zh}: ${allPath}`);
|
|
|
// 处理中间件
|
|
|
if (middleware.length > 0) middleware = middleware.map(i => _.get(mwares, i)({ enable: true, model: ckey || rkey }));
|
|
|
// 注册路由
|