Amaresh: Restore dropped eventRouter mount and fix its route ordering bug - #2311
Amaresh: Restore dropped eventRouter mount and fix its route ordering bug#2311amaresh2001 wants to merge 1 commit into
Conversation
|
RuthwikHM
left a comment
There was a problem hiding this comment.
Tested this out with the frontend PR. Issues documented there.
OneCommunityGlobal/HighestGoodNetworkApp#5453 (review)
|
@RuthwikHM Thank you for testing. Replied on the frontend PR; the route responds correctly on this branch (200 on first load, 304 on cache revalidation, not a 404), and the page loads real data end-to-end. Likely a stale local build on the test side. Details in #5453. |
RuthwikHM
left a comment
There was a problem hiding this comment.
This looks good to me. I did have a stale backend build running it seems so that got resolved. Found one really tiny bug though in the UI in dark mode. See this review for more information.
DeMoliT1on
left a comment
There was a problem hiding this comment.
Hi @amaresh2001 ,
Tested locally in Postman and verified that all the APIs are accessible.
Approved!



Description
Restores a real, fully-built Event API (
GET/POST /api/events,/events/types,/events/locations, waitlist/registration endpoints) that was silently dropped fromsrc/startup/routes.jsduring an unrelated merge (fix(1342): adjust backend logic, Nov 13 2025), the mount line andbmIssueRouter's mount both got dropped in that merge's conflict resolution;bmIssueRouterwas restored later,eventRouternever was. This left the route unreachable (404) even though the controller, model, and 192 real event documents in the dev database were all already there and working. Also fixes a route-ordering bug insideeventRouter.jsitself that was invisible while the router was unmounted:/events/:idwas registered before/events/typesand/events/locations, so Express matched those two literal paths as if"types"/"locations"were an:idparam and routed them togetEventByIdinstead, which threw a Mongoose CastError.Related PRS (if any):
This backend PR is related to the frontend PR #5453 (
amaresh/fix-event-participation-static-metrics-and-nav-linkswires the Event Participation Analytics page to this restored API).To test this backend PR, you need to check out the #5453 frontend PR.
Main changes explained:
src/startup/routes.jsfor re-adding theeventRouterrequire and itsapp.use('/api', eventRouter)mount, restoring the route to reachable.How to test:
npm installandnpm run devto run this PR locally.GET localhost:4500/api/events,GET localhost:4500/api/events/types, andGET localhost:4500/api/events/locations(Postman orcurl -H "Authorization: <token>") all three should return real data instead of a 404, and/events/types//events/locationsspecifically should no longer 500/error out on a Mongoose CastError.localhost:5173/communityportal/database/designthis page (an already-shipped feature) that was broken by the same dropped mount and should now load real event cards with working Event Type/Location filter dropdowns instead of a "Failed to fetch filter" error.localhost:5173/communityportal/reports/participation(needs the frontend PR) to see the same real data flowing into the Event Participation Analytics page.Screenshots or videos of changes:
Note: