Bugfix: Why was /api/global-modules returning 404 when the backend c...
Documentation for Sessions
🐛 Bugfix: Why was /api/global-modules returning 404 when the backend c...
📋 Decision Context
Question:
Why was /api/global-modules returning 404 when the backend controller existed?
Task: Not specified
🎯 Decision Made
Chosen:
Remove 'api/' prefix from controller paths since NestJS main.ts already sets app.setGlobalPrefix('api')
Options Considered:
- Remove api/ prefix from controllers
- Remove global prefix from main.ts
- Keep both and update frontend URLs
💭 Reasoning
The NestJS app has a global prefix of 'api' set in main.ts line 50. Controllers with @Controller('api/global-modules') were being registered at /api/api/global-modules (double prefix). Frontend calls /api/global-modules but backend was listening on /api/api/global-modules. Fixed by removing 'api/' from controller decorators so final route = globalPrefix + controllerPath = 'api' + 'global-modules' = '/api/global-modules'
📁 Files Involved
apis/backend-api/src/main.tsapis/backend-api/src/app/global-modules/global-modules.controller.tsapis/backend-api/src/app/global-resources/global-resources.controller.tsapis/backend-api/src/app/data/data.controller.tsapis/backend-api/src/app/ecommerce/orders/orders.controller.tsapis/backend-api/src/app/ecommerce/products/products.controller.tsapis/backend-api/src/app/modules/unified-modules-v2.controller.tsapis/backend-api/src/app/universes/universe-deployment.controller.tsapis/backend-api/src/app/marketplace/marketplace.controller.ts
🔗 Related
- Decision ID:
dev_1767910016585_5ozlz6j - Session: 31
- Workspace: editor2
Auto-generated by MCP Smart Consolidation