Dynamic Controllers
The module can generate REST controllers dynamically:
- Config sections controller
- Config data controller
They are enabled/disabled and customized via controllersOptions.
In async registration, controller options must be provided via staticOptions.controllersOptions.
Default endpoints
Configuration Sections (default: /config/section)
GET /config/section— List all sectionsPOST /config/section— Create a new sectionGET /config/section/:id— Get section by IDPUT /config/section/:id— Update sectionDELETE /config/section/:id— Delete section
Request body (POST/PUT):
{
"name": "api-settings",
"description": "API configuration settings"
}Configuration Data (default: /config/data)
GET /config/data— List all configuration dataPOST /config/data— Create new configurationGET /config/data/:id— Get configuration by IDPUT /config/data/:id— Update configurationDELETE /config/data/:id— Delete configuration
Request body (POST/PUT):
{
"name": "API_KEY",
"value": "your-secret-key",
"environment": "production",
"description": "Production API key",
"isEncrypted": true,
"section": { "id": "section-uuid-here" }
}Customizing endpoints
CrudConfigModule.register({
controllersOptions: {
section: {
properties: {
path: "api/v1/settings/sections",
name: "CustomSectionController",
swagger: {
tags: ["Configuration Sections"],
},
},
},
data: {
properties: {
path: "api/v1/settings/data",
routes: {
DELETE: { isEnabled: false },
},
},
},
},
});Headless mode
If you don’t need HTTP endpoints, disable controllers:
Last updated on