mili
mili copied to clipboard
代码优化建议
像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';