-
Couldn't load subscription status.
- Fork 2.7k
feat(fetch-router): add alias functions for standard HTTP verb paths #10768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
packages/fetch-router/CHANGELOG.md
Outdated
| - Export `InferRouteHandler` and `InferRequestHandler` types | ||
| - Re-export `FormDataParseError`, `FileUpload`, and `FileUploadHandler` from `@remix-run/form-data-parser` | ||
| - Fix an issue where per-route middleware was not being applied to a route handler nested inside a route map with its own middleware | ||
| - Adds functional aliases for routes that respond to a single HTTP verb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this actually go under a new 0.7.0 heading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CHANGELOG is updated when a release is created, this if merged would not be part of an already released version
|
Thanks for the PR, @aaronjordan. I had the same thought. Could you please also add helpers for Also, I'd like to see a test along with this work that asserts the types are still what we expect them to be when these helpers are used in a larger route config. As for the CHANGELOG, we include new changes under a |
|
Thank you for the feedback! I've updated this PR to include these additional methods and a test which revealed a couple of issues that were addressed.
|
Drafted an idea I had watching the reveal livestream. This PR adds functional aliases for simple HTTP routes.
The route objects returned are super simple here, but providing them as functions to call would make the framework appear more consistent when defining a route using helpers. For instance, this would be an existing way to express some routes:
After this change, we would be able to use a consistent syntax for resources, formActions, and single-method routes.
I followed the
resource.tsfile to try to get the style right, please do advise on anything I could update!