What is a controller in NestJS?
A controller handles incoming requests, maps routes, extracts parameters, and delegates work to providers.
The question library
Explore practical questions, clear explanations, and code examples across developer technologies.
Showing 625–636 of 3610 questions
A controller handles incoming requests, maps routes, extracts parameters, and delegates work to providers.
A provider is a class or value managed by Nest's dependency injection container.
Lifecycle hooks let providers or modules react to application initialization, bootstrap, shutdown, and module destruction.
Pipes transform input or validate it before a route handler executes.
A global ValidationPipe applies DTO validation consistently.
Guards decide whether a request may proceed, typically for authentication or authorization.
Interceptors wrap handler execution and can add logging, timing, response mapping, caching, or timeout behavior.
Exception filters catch exceptions and format the HTTP response.
Middleware runs before route handlers and is useful for cross-cutting request tasks such as correlation IDs or simple request logging.
Authentication verifies the caller's identity, often through Passport strategies, sessions, or bearer tokens.
Role-based authorization checks a trusted user's roles against metadata required by an endpoint.
Custom decorators encapsulate repeated metadata or request extraction.