-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Router As Separate Module #2411
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
Comments
There has and it will :)! I'll keep this open until it does, and I can link the 5.0 TODO to this ticket. |
Awesome! Thanks for the quick reply. If you have any references to where this discussion is happening I would love to browse through it....and maybe add in my 2c :) |
Discussion was really a "hey, let's take the exact router that's in express 4 and put it in a new module", really :) If there is anything specific you'd like to discuss, please feel free to use this issue as the forum, as I don't think there was one anywhere permanent before. |
That would be awesome. I ended up pulling it out into a separate module for my own use: https://github.com/ajacksified/express-router |
@ajacksified Note: the official one will be here: https://github.com/pillarjs/router The first commit is still wip though, and I think @dougwilson is still going to push over it a couple times. |
Also discussion in #2431 |
indeed :) the biggest thing is the router at pillarjs/router will be usable without express methods on the prototype (i.e. |
The current express 4 router, extracted as-is, doesn't create a server or appear to rely on express (I may be missing something somewhere); but, at any rate, that's a great goal. My own motivations are weird: I just want something that maps express-style routes to a function, that I can use client- and server- side; existing routers like director and router.js make a lot of assumptions and I need something lower-level and more lightweight, a thin layer on top of path-to-regexp. |
@ajacksified sounds like a custom router is right for you then. :) I may suggest basing it off of the extracted router once it;s ready though - it will probably be more stable. |
@Fishrock123 Yup, I'll keep an eye on this - thanks! |
@ajacksified I am in a very similar situation, so you are not weird in that. I am working on an isomorphic app where it would be really nice to define our routes/middleware once. @Fishrock123 are you saying that a use case like this would be better suited to a different solution? |
Speaking of thin layers on top of @wesleytodd I am saying this is the perfect case for a custom router. For maximum interoperability, it may be worthwhile basing your router's top-level off of the one extracted from express, however. |
+1 |
fwiw, for front-end I went with @yoshuawuyts's wayfarer (built on jonathan's trie-router) The current impl doesn't work as a full pillarjs router though, afaik. |
For those coming by, I just published the first version of the official one from https://github.com/pillarjs/router as |
@dougwilson Thanks! |
👍 |
1 similar comment
👍 |
@dougwilson router has been extracted, can this be closed & checked off the list? |
Once the 5.0 branch is actually using it :) |
Ok, this has been integrated in the 5.0 branch and published as part of the 5.0.0-alpha.2 release! |
👍🏻 excellent! |
👏 👏 👏 👏 |
I searched through the issues but couldn't find any previous discussion of this. Has there been any talk, or is there currently, of moving the Router out into a stand-alone module?
The text was updated successfully, but these errors were encountered: