Reputation: 557
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
Upvotes: 10
Views: 8444
Reputation: 70191
This is commented on in the docs
Your understanding though, is correct, the docs go into a bit more detail when it comes to running multiple of each type and how they order at that point. Definitely worth the read.
Upvotes: 7