NestJS includes a lot of tools that seem to function as specialized versions of middleware like guards, interceptors, and filters.
What is the order of execution between all of these?
My understanding is that the order of execution goes like this:
Middleware -> Guards -> Interceptors -> Pipes -> Controllers -> Interceptors -> res.on('finish')
handlers set up in middleware
NestJS includes a lot of tools that seem to function as specialized versions of middleware like guards, interceptors, and filters.
What is the order of execution between all of these?
My understanding is that the order of execution goes like this:
Middleware -> Guards -> Interceptors -> Pipes -> Controllers -> Interceptors -> res.on('finish')
handlers set up in middleware
1 Answer
Reset to default 7This is mented on in the docs
Your understanding though, is correct, the docs go into a bit more detail when it es to running multiple of each type and how they order at that point. Definitely worth the read.