Static social-media routes are shadowed by the post ID route
Author: dajiaohuangCreated Sep 17, 2026Updated Sep 17, 2026
Problem
The dynamic GET /{post_id} route is registered before the static routes under the same router, including /platforms/list, /sentiments/list, and /trends/time. Starlette evaluates routes in declaration order, so those static paths are captured by read_post instead of their intended handlers.
Reproduction
On the current main branch, inspect the router table or request GET /api/social-media/platforms/list. The first matching route is /{post_id}, with post_id set to platforms/list.
Expected behavior
Static endpoints should resolve to their named handlers, while /{post_id} should handle only IDs that do not match a static path.
Proposed fix
Register the static routes before the dynamic /{post_id} route.
Source: Shubhamsaboo/awesome-llm-apps