Your routes are identical... so of course that would happen... You either
need to:

a) vary your routes /customers/byId/:id /customers/byName/:name
b) /customers/:idOrName and test if the value is an ID or a name and route
from there inside your method...

-Karl Tiedt


On Thu, Jan 17, 2013 at 5:54 PM, Ryan Kelly <[email protected]>wrote:

> 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
>

-- 
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

Reply via email to