visionmedia / express-resource

Resourceful routing for Express
1.41k stars 140 forks source link

Make it easier to define progressive actions #7

Closed tj closed 13 years ago

tj commented 13 years ago

currently:

var users = app.resource('users', actions);

 users.get('/foo')

is GET /users/foo, not GET /users/:user/foo as some would expect, however we do need a way to define both. I propose that users.get('/foo/bar') is /users/foo/bar, andusers.get('foo/bar')is/users/:user/foo/bar`

gf3 commented 13 years ago

I like the idea, but I think I would prefer :user_id vs :user. That's just my personal preference though, coming from the ruby world.

tj commented 13 years ago

yeah, but two reasons that is worse IMO:

  1. to use js idioms we would camel-case, which is ugly for ids "userID" or "userId" both look pretty bad
  2. it's not always an id, it could be a slug etc
tj commented 13 years ago

plus I have this changed already haha, the issue is just for defining additional actions