NestJS · Middle · Question 60 of 75
How do you exclude some routes from a middleware?
- 1Add
@SkipMiddleware()to the route - 2Middleware can't exclude routes
- ✓Correct answer:
consumer.apply(Mw).exclude({ path: 'health', method: RequestMethod.GET }).forRoutes('*')
Explanation
forRoutes accepts paths, controllers or route info objects.