Skip to content

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

Closed
wesleytodd opened this issue Oct 23, 2014 · 23 comments
Closed

Router As Separate Module #2411

wesleytodd opened this issue Oct 23, 2014 · 23 comments
Assignees
Milestone

Comments

@wesleytodd
Copy link
Member

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?

@dougwilson
Copy link
Contributor

There has and it will :)! I'll keep this open until it does, and I can link the 5.0 TODO to this ticket.

@wesleytodd
Copy link
Member Author

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 :)

@dougwilson
Copy link
Contributor

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.

@ajacksified
Copy link

That would be awesome. I ended up pulling it out into a separate module for my own use: https://github.com/ajacksified/express-router

@Fishrock123
Copy link
Contributor

@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.

@Fishrock123
Copy link
Contributor

Also discussion in #2431

@dougwilson
Copy link
Contributor

and I think @dougwilson is still going to push over it a couple times

indeed :) the biggest thing is the router at pillarjs/router will be usable without express methods on the prototype (i.e. http.createServer(router) and the like) which makes it much more usable than a straight express 4 router extraction.

@ajacksified
Copy link

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.

@Fishrock123
Copy link
Contributor

@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.

@ajacksified
Copy link

@Fishrock123 Yup, I'll keep an eye on this - thanks!

@dougwilson dougwilson added this to the 5.0 milestone Nov 7, 2014
@wesleytodd
Copy link
Member Author

@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?

@Fishrock123
Copy link
Contributor

Speaking of thin layers on top of path-to-regexp, does path-match fill your needs? (tbh, I will actually need a front-end router for my own app within a few days.)

@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.

@mahnunchik
Copy link

+1

@Fishrock123
Copy link
Contributor

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.

@dougwilson
Copy link
Contributor

For those coming by, I just published the first version of the official one from https://github.com/pillarjs/router as [email protected] on npm.

@wesleytodd
Copy link
Member Author

@dougwilson Thanks!

@hacksparrow
Copy link
Member

👍

1 similar comment
@AndrewJHart
Copy link

👍

@Fishrock123
Copy link
Contributor

@dougwilson router has been extracted, can this be closed & checked off the list?

@dougwilson
Copy link
Contributor

Once the 5.0 branch is actually using it :)

dougwilson added a commit that referenced this issue Jul 7, 2015
@dougwilson dougwilson self-assigned this Jul 7, 2015
@dougwilson
Copy link
Contributor

Ok, this has been integrated in the 5.0 branch and published as part of the 5.0.0-alpha.2 release!

@hacksparrow
Copy link
Member

👍🏻 excellent!

@wesleytodd
Copy link
Member Author

👏 👏 👏 👏

@expressjs expressjs locked and limited conversation to collaborators Sep 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants