shen100 / mili

mili 是一个开源的社区系统,界面优雅,功能丰富😛
https://www.nodejs123.com/
GNU General Public License v2.0
2.94k stars 684 forks source link

代码优化建议 #325

Open Qinmei opened 4 years ago

Qinmei commented 4 years ago

像middleware这些, 最好是在index.ts中先import然后统一export, 这样其他页面只需要引用一个文件, 减少代码:

像下面这种:

import { CorsMiddleware } from './core/middleware/cors.middleware';
import { CSRFMiddleware } from './core/middleware/csrf.middleware';
import { IpMiddleware } from './core/middleware/ip.middleware';
import { HelmetMiddleware } from './core/middleware/helmet.middleware';

可以优化成:

import { CorsMiddleware,CSRFMiddleware, IpMiddleware ,HelmetMiddleware  } from './core/middleware';