Complete the code to apply middleware globally in NestJS.
app.[1](LoggerMiddleware);In NestJS, the use method applies middleware globally.
Complete the code to apply middleware only to a specific route.
consumer
.apply(AuthMiddleware)
.forRoutes({ path: '[1]', method: RequestMethod.GET });The middleware is applied only to the '/users' GET route.
Fix the error in the middleware order to ensure LoggerMiddleware runs before AuthMiddleware.
consumer .apply([1], AuthMiddleware) .forRoutes('*');
Middleware order matters. LoggerMiddleware should be first to log all requests before authentication.
Fill both blanks to apply two middlewares in correct order for all routes.
consumer .apply([1], [2]) .forRoutes('*');
LoggerMiddleware should run first, then AuthMiddleware, for all routes.
Fill all three blanks to apply three middlewares in order: Logger, Auth, then Cors for all routes.
consumer .apply([1], [2], [3]) .forRoutes('*');
The correct order is LoggerMiddleware first, then AuthMiddleware, then CorsMiddleware for all routes.