Question · NestJS course · Module 2: Routing and Request Lifecycle

The next() Function in Middleware

What happens if middleware does NOT call the next() function?

Answer options

  • The middleware will execute twice
  • The request will automatically pass to the controller
  • The server will restart
  • The request will hang - it won't proceed further in the chain
Show the answer

Correct answer:

  • The request will hang - it won't proceed further in the chain