It is not clear why you use interceptors for security instead of guards.
Yeah you're right, but in general guards in Nest.js are also some kind of interceptors because you get access to the request, check certain things and decide if you wanna pass the request through or block it. That's why I first talked about interceptors in general and then go into details in Nest. When you have an express application without the concepts of guards you would probably use interceptors for that concept as well. Makes sense?
Jean-Marc Möckel, yes, I agree that guards can be considered a subset of interceptors, but NestJS does not guarantee that a particular interceptor will necessarily be called first (before any other interceptors). And this is a problem.
Костя Третяк Yeah but you can control it because even with interceptors you can create a certain hierarchy. Global Interceptors -> Module Interceptors -> Route Interceptors. With leveraging that you can control to a certain degree which interceptor should be called first. But I get your point. This can sometimes lead to some issues because you don't want to run a globally implemented interceptor in all cases.
Костя Третяк
typescript, ditsmod, sql, nodejs, nestjs, ditsmod
It is not clear why you use interceptors for security instead of guards.