Skip to content

Support query-based route rewrites#1751

Open
VeeraVardhan35 wants to merge 1 commit intotypicode:mainfrom
VeeraVardhan35:fix-query-based-route-rewrites
Open

Support query-based route rewrites#1751
VeeraVardhan35 wants to merge 1 commit intotypicode:mainfrom
VeeraVardhan35:fix-query-based-route-rewrites

Conversation

@VeeraVardhan35
Copy link
Copy Markdown

Adds support for query-based route patterns in routes.json, for example:

{
"/blog?customNamedId=:id": "/posts?id=:id"
}

This change:

  • Parses route patterns with query params
  • Matches req. path and req .query
  • Extracts params lie: id
  • Replaces params in destination URLs
  • Rewrites req.url before existing API routing
  • Preserves unrelated query params
  • Leaves existing routes unchanged

Verified with:

  • npm run lint
  • npm run typecheck
  • npm test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant