Skip to content

[Bug] Event routes have a double /api prefix — all event endpoints return 404 in production #250

@MehtabSandhu11

Description

@MehtabSandhu11

Summary

eventRoutes is registered in app.ts with the prefix /api/events. However, every route handler inside apps/backend/src/routes/event.ts also hard-codes /api/events as the path prefix. The result is that all event endpoints resolve to /api/events/api/events/..., which is unreachable by any client.

Root Cause

apps/backend/src/app.ts line 100:

await app.register(eventRoutes, { prefix: '/api/events' });

apps/backend/src/routes/event.ts lines 39, 101, 135, 175, 214:

app.post('/api/events', ...)           // actual path: /api/events/api/events
app.get('/api/events/:slug', ...)      // actual path: /api/events/api/events/:slug
app.post('/api/events/:slug/join', ...) // etc.

Every other route file (e.g. cards.ts, profiles.ts) correctly uses relative paths like '/' and '/:id'. Only event.ts duplicates the prefix.

Expected Behaviour

  • POST /api/events → create event
  • GET /api/events/:slug → get event
  • POST /api/events/:slug/join → join event

Proposed Fix

In apps/backend/src/routes/event.ts, change all absolute route paths to relative ones:

// Before
app.post('/api/events', ...)
app.get('/api/events/:slug', ...)
app.post('/api/events/:slug/join', ...)
app.delete('/api/events/:slug/leave', ...)
app.get('/api/events/:slug/attendees', ...)

// After
app.post('/', ...)
app.get('/:slug', ...)
app.post('/:slug/join', ...)
app.delete('/:slug/leave', ...)
app.get('/:slug/attendees', ...)

Acceptance Criteria

  • All 5 event routes respond at their documented paths under /api/events
  • The double-prefix pattern does not appear in any other route file
  • Existing event tests pass after the fix

Please assign this issue to me under GSSoC

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions