Object style route definition #694
StrangeBytesDev
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is of course subjective, but it feels pretty unintuitive putting the schema for a route after the handler itself. When looking at a route, seeing its inputs and outputs first just makes for really smooth DX. Being subjective though, I might be in the minority and most people might prefer having their schema following the handler.
A really nice way to allow for either format though would be to use a syntax similar to Fastify's route method which takes an object for the argument, and lets you organize it however you want. I think having something similar in Elysia would make the already great DX even greater.
Something like this:
Beta Was this translation helpful? Give feedback.
All reactions