RoutesOptions interface allows you to customize individual CRUD routes, exclude specific routes, or add decorators and interceptors to specific endpoints.
Interface Definition
Properties
Array of route names to exclude from the controller.Use this when you want most routes but need to exclude specific ones.
Array of route names to include. Only these routes will be generated.Use this when you want only specific routes and want to exclude everything else.
Configuration for the GET (list) endpoint.Accepts
BaseRouteOptions with interceptors and decorators properties.Configuration for the GET (single) endpoint.Accepts
BaseRouteOptions with interceptors and decorators properties.Configuration for the POST (create single) endpoint.Extends
BaseRouteOptions with:returnShallow: If true, returns only the created entity’s ID instead of the full entity
Configuration for the POST (create bulk) endpoint.Accepts
BaseRouteOptions with interceptors and decorators properties.Configuration for the PATCH (partial update) endpoint.Extends
BaseRouteOptions with:allowParamsOverride: If true, allows request body to override URL parametersreturnShallow: If true, returns only the entity’s ID instead of the full entity
Configuration for the PUT (full replace) endpoint.Extends
BaseRouteOptions with:allowParamsOverride: If true, allows request body to override URL parametersreturnShallow: If true, returns only the entity’s ID instead of the full entity
Configuration for the DELETE endpoint.Extends
BaseRouteOptions with:returnDeleted: If true, returns the deleted entity in the response
Configuration for the PATCH (recover soft-deleted) endpoint.Extends
BaseRouteOptions with:returnRecovered: If true, returns the recovered entity in the response
BaseRouteOptions
All route-specific options extend fromBaseRouteOptions:
Array of NestJS interceptors to apply to this specific route.
Array of decorators to apply to this specific route method.
BaseRouteName Type
TheBaseRouteName type includes all available CRUD route names:
Usage Examples
Exclude Specific Routes
Only Include Specific Routes
Add Decorators and Interceptors
Configure Return Behavior
Notes
You cannot use both
exclude and only at the same time. Use exclude when you want most routes, or only when you want to be explicit about which routes to include.