kieran / barista

A URL router / generator for NodeJS
https://kieran.github.io/barista/
MIT License
111 stars 22 forks source link

router.resource problem #10

Closed misterjt closed 10 years ago

misterjt commented 11 years ago

router.resource('product'); /product/1/edit - Not mathced (false) /products/1/edit - matched (true) What to do? Is that feature or bug?

kieran commented 11 years ago

That's was actually a feature, though in retrospect I think it was probably a mistake. Right now it pluralizes and snake_cases resources in the URL. The idea was that you could pass a model name (like Product) in, and it would generate /products/1/edit etc... but I really hadn't thought it through completely.

I'll probably change it to the rails convention of resources for collections (like /products) and resource for a single resource (like /account), and leave the input string alone. I'll throw a deprecation warning in the next release (which should be soon!), then add the new feature for 1.0 (also soonish!)