add http verbs methods to Router #1454

Merged
merged 1 commit into from Dec 28, 2012

Conversation

Projects
None yet
4 participants
Contributor

defunctzombie commented Dec 25, 2012

By having the method verbs available on the router, users can set up
disjoint routers and organized paths easier.

It is now possible to have a .js file export the router.middleware and
attach these paths using an app.use('/path', middleware) call. This
means that any routes written in the separate file do not need to have a
full path hardcoded as they can be mounted by the application anywhere.

This is already possible using router.route(verb, args) however is
needlessly verbose without this patch.

add http verbs methods to Router
By having the method verbs available on the router, users can set up
disjoint routers and organized paths easier.

It is now possible to have a .js file export the router.middleware and
attach these paths using an `app.use('/path', middleware)` call. This
means that any routes written in the separate file do not need to have a
full path hardcoded as they can be mounted by the application anywhere.

This is already possible using `router.route(verb, args)` however is
needlessly verbose without this patch.
Owner

tj commented Dec 28, 2012

until we completely move the router into its own npm module (which would have to have some lame name now :() it doesn't have much value IMO, it's a little weird to dig into express for the router middleware itself, especially when you can do app.use('/path', otherapp) just as easily

express-router

Contributor

defunctzombie commented Dec 28, 2012

what router did you use for 'path' ?

creating a whole new app seemed like overkill :) when the real thing I want is the router
On Dec 28, 2012, at 12:13 PM, TJ Holowaychuk notifications@github.com wrote:

until we completely move the router into its own npm module (which would have to have some lame name now :() it doesn't have much value IMO, it's a little weird to dig into express for the router middleware itself, especially when you can do app.use('/path', otherapp) just as easily


Reply to this email directly or view it on GitHub.

Owner

tj commented Dec 28, 2012

it's not really overkill I mean express is effectively a router with some settings and http methods that node should have, I'll merge and work on moving it out a bit so it's not quite as awkward to reach into. @juzerali that's taken already :D haha

tj added a commit that referenced this pull request Dec 28, 2012

@tj tj merged commit 618484a into expressjs:master Dec 28, 2012

1 check passed

default The Travis build passed
Details
Contributor

defunctzombie commented Dec 28, 2012

we need a nice creating and awesome name for it :)
On Dec 28, 2012, at 12:30 PM, TJ Holowaychuk notifications@github.com wrote:

it's not really overkill I mean express is effectively a router with some settings stuff, I'll merge and work on moving it out a bit so it's not quite as awkward to reach into. @juzerali that's taken already :D haha


Reply to this email directly or view it on GitHub.

rump commented Dec 28, 2012

verbs? ;)

Contributor

defunctzombie commented Dec 28, 2012

byway
On Dec 28, 2012, at 12:37 PM, Sean Dunaway notifications@github.com wrote:

verbs? ;)


Reply to this email directly or view it on GitHub.

rlidwka pushed a commit to rlidwka/express that referenced this pull request Aug 6, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment