-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Built-in HTTP Routing API #50321
Comments
I personally prefer to see how we can help libraries like fastify or wrappers like Nest.js better than to own all of this. These projects need a different cadence and release cycle and to not break a lot which isn't great for core. That said, I can probably find 5-10 such comments I've made over the years over features that eventually made it into core - so there's also that. So -0.5 for me |
It's not quite true - developers can write simple switch-case without third-party libraries. |
I honestly like the idea but right now I'm -1 due to the state of the http module, it needs some love before adding a big feature like this |
Routing is not quite as simple as switching over static strings. Generally, you want to bind route path parameters to variables, plus a good number of other features. Doing this performantly requires a solid datastructure and implementation, such as a Radix Tree. Writing this is non-trivial, and likely we wouldn't expect developers to write this themselves for every project -- or write an implementation and then copy-paste it. |
Totally agree. And this is why such rich functionality should stay in third-party libraries, which can have different philosophy, design, strong / weak areas, known limitations, middleware, etc. |
The inclusion of |
Having this functionality built-in and in the native layer can help open the door to interesting possibilities like routing as early as possible to sandboxes. |
You're never going to get everyone to agree on the API though. I like the proposal in the abstract but I also think there's zero chance of it actually happening. |
Also worth mentioning, all the design questions and decisions that have just happened in the Go std lib about this topic : golang/go#61410 |
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-stale
|
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment. For more information on how the project manages feature requests, please consult the feature request management document. |
What is the problem this feature will solve?
Developers will have the option not to rely on third-party libraries for writing basic web applications.
This improves developer experience and productivity with the language, lowering the barrier for newcomers.
Rather than needing to learn both Node.js and how package managers work, a new programmer can download Node, create an
index.js
, and import the default HTTP server with routing capabilities.I'd be curious to hear folks' opinions on:
lib/_http_server.js
, or in C++ for performance?Good prior art in this area for inspiration includes the https://github.com/delvedor/find-my-way library and Fastify's use of it in it's own Router.
I'm happy to attempt a contribution here (in either JS or C++) assuming all of the above are sorted out.
It's not my intention to request this as a feature with the expectation that someone else will do it.
What is the feature you are proposing to solve the problem?
See above
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: