Put in order · NestJS course · Module 2: Routing and Request Lifecycle
Registering Middleware in a Module
Order the steps for registering middleware in NestJS from first to last:
Items to put in order
- Specifying routes using .forRoutes()
- Calling consumer.apply(Middleware) in the configure() method
- Implementing the NestModule interface in the module class
- Creating a middleware class with @Injectable()
Show the answer
Correct order:
- Creating a middleware class with @Injectable()
- Implementing the NestModule interface in the module class
- Calling consumer.apply(Middleware) in the configure() method
- Specifying routes using .forRoutes()