On Monday, November 4, 2013 10:54:12 PM UTC+4, José F. Romaniello wrote:
>
>
> 2013/11/4 Simon <[email protected] <javascript:>>
>
>>     app.get('/users/:id[int]', function(req, res, id) { ... });
>>     app.get('/users/:name', function(req, res, username) { ... });
>>
>
>
> Besides the syntax, IMHO this particular example doesn't sound like a good 
> API, some of my concerns: 
>
> -  It means that the same resource will be found in two different urls
>

Almost all resources can be retrieved using different urls, hardly an issue.

-  Will this api support PUT/PATCH/DELETE to both name and id, etc
> -  Few days ago I watched a movie where the protagonist name was 6 
> http://www.imdb.com/character/ch0250776/?ref_=ttfc_fc_cl_t21 (joke)
>
> For this particular case, I often have /users/:id and /user?name=x, which 
> read as *query the user resources by name*.
>

Simon's API is very good if :name is heavily restricted to non-numeric 
ascii strings (like /[-_a-z][-_a-z0-9]*/). If it's not, a number of issues 
will come out, so I'm using '/users/:id' and '/users/search?name=:name' 
usually.

Mixing plural and singular forms of the same word ("user", "users") sounds 
like a bad idea anyway.

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

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to