#How can I use @UseGurads in module file
4 messages · Page 1 of 1 (latest)
Sadly, you can't. There's nothing like module-scoped guards in Nest. If you don't want to apply it globally for the whole app, you'll have to apply it to each controller in that module individually.
Instead of a guard you could write a module scoped middleware
Prob the closest thing you will get
There's also no such thing as a module scoped middleware. Middlewares are bound to route paths. So, I mean, if all the controllers in a module are on a specific subpath, then yes, you could technically bind a middleware to a "module".