API conventions
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
Global prefix
Section titled “Global prefix”- Most HTTP routes:
/api/v1/<controller-path>(seesetGlobalPrefixinbootstrap-http.ts).
Swagger / OpenAPI
Section titled “Swagger / OpenAPI”- UI: default
GET /docs— override withSWAGGER_PATH(no leading slash). - JSON:
GET /docs-jsonby default (path follows{SWAGGER_PATH}-json). - These paths are excluded from the
api/v1prefix so URLs stay stable. - Bearer JWT: authorize in Swagger UI (
persistAuthorization: true).
Deployed Swagger base URL
Section titled “Deployed Swagger base URL”Replace with your public API origin when known:
| Environment | Base URL (example) |
|---|---|
| Local dev | http://localhost:3000 → Swagger UI at /docs |
| Staging / production | https://<your-api-host> → TBD — set here when the hostname is fixed |
Full Swagger UI URL: {base}/docs (or /{SWAGGER_PATH} if overridden). OpenAPI JSON: {base}/{SWAGGER_PATH}-json.
Client usage
Section titled “Client usage”- Send
Authorization: Bearer <token>for protected routes. - Prefer generated or hand-maintained clients from the OpenAPI document rather than duplicating fields in this docs site.
Environment
Section titled “Environment”SWAGGER_ENABLED— set tofalseto disable Swagger entirely.
Related
Section titled “Related”- Backend API catalog — all operations exported from OpenAPI (grouped by Swagger tag); static JSON at
/openapi.json - Backend architecture (NestJS) — how the global prefix and Swagger exclusions are applied
- Backend modules — feature modules behind
/api/v1