Problem Statement
All backend API routes use bare paths: /gists, /gists/:id, /health. There is no version prefix (e.g., /v1/gists). This means breaking API changes require coordinated deployment of all consumers with no backward compatibility path.
Evidence
Backend/src/gists/gists.controller.ts — @controller('gists'), no version prefix
Backend/src/health/health.controller.ts — @controller('health'), no version prefix
Backend/src/app.controller.ts — @get('health'), no version prefix
Impact
Breaking API changes would break all existing consumers. No support for multiple API versions during migration.
Proposed Solution
- Add
globalPrefix option in main.ts: app.setGlobalPrefix('v1')
- Update health route to be under /v1 prefix
- Update any hardcoded frontend API URLs to include /v1/
- Update E2E tests to use /v1/ prefix
- Add deprecation header support for future version transitions
Technical Requirements
- Global prefix must not apply to /health if used by load balancer health checks (exclude health route)
- Must use NestJS setGlobalPrefix with exclude() for health routes
- All existing routes must work under /v1/
Acceptance Criteria
- POST /v1/gists returns 201
- GET /v1/gists returns 200
- GET /v1/gists/:id returns 200
- GET /v1/health returns 200
- Old routes without /v1/ return 404
- Frontend API calls use /v1/ prefix
- All E2E tests pass with new prefix
- Health route excluded from global prefix for load balancer
File Inventory
Backend/src/main.ts
Backend/src/gists/gists.controller.ts
Backend/src/health/health.controller.ts
Backend/test/gists.e2e.spec.ts
Backend/test/app.e2e-spec.ts
Dependencies
None.
Testing Strategy
- E2E tests with and without /v1/ prefix
- Unit tests for route registration
Security Considerations
API versioning enables safer deployments and gradual migration.
Definition of Done
Problem Statement
All backend API routes use bare paths:
/gists,/gists/:id,/health. There is no version prefix (e.g.,/v1/gists). This means breaking API changes require coordinated deployment of all consumers with no backward compatibility path.Evidence
Backend/src/gists/gists.controller.ts— @controller('gists'), no version prefixBackend/src/health/health.controller.ts— @controller('health'), no version prefixBackend/src/app.controller.ts— @get('health'), no version prefixImpact
Breaking API changes would break all existing consumers. No support for multiple API versions during migration.
Proposed Solution
globalPrefixoption in main.ts:app.setGlobalPrefix('v1')Technical Requirements
Acceptance Criteria
File Inventory
Backend/src/main.tsBackend/src/gists/gists.controller.tsBackend/src/health/health.controller.tsBackend/test/gists.e2e.spec.tsBackend/test/app.e2e-spec.tsDependencies
None.
Testing Strategy
Security Considerations
API versioning enables safer deployments and gradual migration.
Definition of Done