admin 管理员组

文章数量: 1086019

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

Share Improve this question edited Dec 11, 2020 at 16:24 Jonathan Hall 79.8k19 gold badges159 silver badges203 bronze badges asked Dec 11, 2020 at 16:21 Greg ThomasGreg Thomas 5676 silver badges17 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

This 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.

本文标签:

Error[2]: Invalid argument supplied for foreach(), File: /www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm, Line: 58
File: /www/wwwroot/roclinux.cn/tmp/route_read.php, Line: 205, include(/www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm)
File: /www/wwwroot/roclinux.cn/tmp/index.inc.php, Line: 129, include(/www/wwwroot/roclinux.cn/tmp/route_read.php)
File: /www/wwwroot/roclinux.cn/index.php, Line: 29, include(/www/wwwroot/roclinux.cn/tmp/index.inc.php)