visionmedia / express-resource

Resourceful routing for Express
1.41k stars 140 forks source link

Singular resources #6

Open tj opened 13 years ago

tj commented 13 years ago

we could use lingo.en.isSingular() to detect and auto-magically support this

gf3 commented 13 years ago

I suppose it depends on how opinionated you want to be.

tj commented 13 years ago

we definitely have to be flexible, but I think we can do magic, and retain the flexibility

gf3 commented 13 years ago

Makes sense to me.

macavon commented 13 years ago

You mean that resource('profile', actions) makes a singular resource and resource('users', actions) a plural one, right? This seems intuitively appealing, but you know someone's going to try resource('sheep', actions) don't you? So maybe you do need some way of disambiguating or over-riding the convention.

Also, presumably people will immediately start wanting to use different languages. Words ending in 's' will look the same singular and plural in French, also Spanish apparently.

tj commented 13 years ago

that's the idea, it would basically just expand at the API level, so something like resource('profile') would make a call to say singularResource('profile') similar, allowing the call to be explicit when needed but still adding some sugar on top of the high level portion of the API. Just a thought.

macavon commented 13 years ago

It's a very good thought, but you might be wise to expose singularResource anyway, to get round the awkward cases.

tj commented 13 years ago

yup, that's the plan

macavon commented 13 years ago

I still like the idea of using magic, but I've just sent a pull request with a different way of doing it.

I'm sure I must have missed something, otherwise it's too easy.

sgronblo commented 10 years ago

I guess nobody is working on this anymore?