Skip to content

Instantly share code, notes, and snippets.

@jbouhier
Last active February 28, 2025 06:10
Show Gist options
  • Save jbouhier/bbcfce7098a1465ef772230127921552 to your computer and use it in GitHub Desktop.
Save jbouhier/bbcfce7098a1465ef772230127921552 to your computer and use it in GitHub Desktop.
NextJS Decorators

NestJS Decorators

  • @Injectable(): Marks a class as a provider that can be managed by NestJS dependency injection system.
  • @Module(): Defines a module in NestJS, organizing the application structure.
  • @Controller(): Defines a basic controller in NestJS.
  • @Get(), @Post(), @Put(), @Delete(): HTTP method decorators for route handlers in controllers.
  • @Param(): Extracts parameters from the request.
  • @Body(): Extracts the entire body from the request.
  • @Query(): Extracts query parameters from the request.
  • @Headers(): Extracts specific headers from the request.
  • @Inject(): Injects a custom provider or dependency into a class.
  • @UseGuards(): Applies route guards to a specific route handler or controller.
  • @UseInterceptors(): Binds interceptors to a specific route handler or controller.
  • @UsePipes(): Applies pipes to a specific route handler or controller.
  • @UseFilters(): Binds exception filters to a specific route handler or controller.
  • @SetMetadata(): Attaches custom metadata to route handlers.

https://docs.nestjs.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment