Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代码优化建议 #325

Open
Qinmei opened this issue Mar 23, 2020 · 0 comments
Open

代码优化建议 #325

Qinmei opened this issue Mar 23, 2020 · 0 comments

Comments

@Qinmei
Copy link

Qinmei commented Mar 23, 2020

像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';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant