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:

  1. Remove api/ prefix from controllers
  2. Remove global prefix from main.ts
  3. 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


🔗 Related


Auto-generated by MCP Smart Consolidation