Coding task · NestJS course · Module 2: Routing and Request Lifecycle

Interceptor in the Request Lifecycle

Create an interceptor with before and after logic.

Task

Write a LifecycleInterceptor that stores Date.now() before next.handle() and, in tap(...) after the response, logs how many milliseconds handling the request took