Skip to main content
The RoutesOptions interface allows you to customize individual CRUD routes, exclude specific routes, or add decorators and interceptors to specific endpoints.

Interface Definition

Properties

BaseRouteName[]
Array of route names to exclude from the controller.Use this when you want most routes but need to exclude specific ones.
BaseRouteName[]
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.
GetManyRouteOptions
Configuration for the GET (list) endpoint.Accepts BaseRouteOptions with interceptors and decorators properties.
GetOneRouteOptions
Configuration for the GET (single) endpoint.Accepts BaseRouteOptions with interceptors and decorators properties.
CreateOneRouteOptions
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
CreateManyRouteOptions
Configuration for the POST (create bulk) endpoint.Accepts BaseRouteOptions with interceptors and decorators properties.
UpdateOneRouteOptions
Configuration for the PATCH (partial update) endpoint.Extends BaseRouteOptions with:
  • allowParamsOverride: If true, allows request body to override URL parameters
  • returnShallow: If true, returns only the entity’s ID instead of the full entity
ReplaceOneRouteOptions
Configuration for the PUT (full replace) endpoint.Extends BaseRouteOptions with:
  • allowParamsOverride: If true, allows request body to override URL parameters
  • returnShallow: If true, returns only the entity’s ID instead of the full entity
DeleteOneRouteOptions
Configuration for the DELETE endpoint.Extends BaseRouteOptions with:
  • returnDeleted: If true, returns the deleted entity in the response
RecoverOneRouteOptions
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 from BaseRouteOptions:
any[]
Array of NestJS interceptors to apply to this specific route.
(PropertyDecorator | MethodDecorator)[]
Array of decorators to apply to this specific route method.

BaseRouteName Type

The BaseRouteName 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.
When using returnShallow: true, the response will only contain the entity’s primary key field(s). This is useful for reducing response size but may require additional requests to fetch full entity data.