You should not have two routes for the same object. Cause when the name is
unique like the id you should not need the id. For me there should be only
one way to access the object. You should design your get for the name like
a search. Something like /customers?name=John+Doe
Am Freitag, 18. Januar 2013 00:54:19 UTC+1 schrieb Ryan Kelly:
>
> I am looking for recommendations on setting up routers using Restify. I
> would like to route to the appropriate requests in the most elegant way.
>
> For example, I want to provide at least two ways to GET a customer.
>
> server.get('/customers/:id', customers.findById);
> server.get('/customers/:name', customers.findByName);
>
> However, all requests route to .findById since it is the first route
> defined. Is there a "good" way to handle this?
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en