Click in order · NestJS course · Module 9: Deployment and Infrastructure
NestJS Middleware Hardening Order
Arrange security middleware in the recommended order of adding to main.ts:
Items to click
- app.listen(port) - server startup
- app.useGlobalPipes(new ValidationPipe()) - validation
- app.use(compression()) - compression
- app.use(helmet()) - security headers
- app.enableCors(corsOptions) - CORS
You can check the correct answer by solving this task in the CodeWorlds game.