routes configuration option allows you to customize or exclude individual CRUD routes.
Routes interface
Excluding routes
Useexclude to prevent specific routes from being generated:
Only specific routes
Useonly to generate only specific routes:
The
exclude and only options are mutually exclusive. Use one or the other, not both.Available route names
All route names use theBase suffix:
getManyBase- GET collectiongetOneBase- GET single entitycreateOneBase- POST single entitycreateManyBase- POST bulk createupdateOneBase- PATCH updatereplaceOneBase- PUT replacedeleteOneBase- DELETErecoverOneBase- PATCH recover (soft delete)
Base route options
All route types support these common options:Array of NestJS interceptors to apply to this route.
Array of decorators to apply to this route.
Example: Adding interceptors
Example: Adding decorators
Create route options
createOneBase
When
true, returns only the created entity without relations.createManyBase
Interceptors for bulk create operations.
Decorators for bulk create operations.
Update route options
updateOneBase
When
true, allows request body to override URL parameters.When
true, returns only the updated entity without relations.replaceOneBase
When
true, allows request body to override URL parameters.When
true, returns only the replaced entity without relations.Delete route options
deleteOneBase
When
true, returns the deleted entity in the response.returnDeleted:
returnDeleted: true:
Recover route options
recoverOneBase
When
true, returns the recovered entity in the response.The
recoverOneBase route is only available when query.softDelete is enabled.Get route options
getManyBase and getOneBase
These routes support the base options (interceptors and decorators) but have no additional specific options.Complete example
Route HTTP methods and paths
Here’s how each route maps to HTTP methods:| Route Name | HTTP Method | Path | Description |
|---|---|---|---|
getManyBase | GET | / | Get multiple entities |
getOneBase | GET | /:id | Get single entity |
createOneBase | POST | / | Create one entity |
createManyBase | POST | /bulk | Create multiple entities |
updateOneBase | PATCH | /:id | Partial update |
replaceOneBase | PUT | /:id | Full replacement |
deleteOneBase | DELETE | /:id | Delete entity |
recoverOneBase | PATCH | /:id/recover | Recover soft-deleted entity |
Use cases
Read-only API
Read-only API
No bulk operations
No bulk operations
User profile endpoint
User profile endpoint
Admin-protected deletes
Admin-protected deletes