In my URL routing (express/sinatra-style), I'd like to enable optional 
parameter "filters" (like int, hex) while keeping syntax familiar and 
simple. The typical syntax for a routing library might look something like:

    app.get('/users/:id', function(req, res, id) { ... });

I'd like to introduce a syntax for catching only numeric ids so we could 
have another route for users by name for instance.

    app.get('/users/:id[int]', function(req, res, id) { ... });
    app.get('/users/:name', function(req, res, username) { ... });

There doesn't seem to be a convention for this, so I've been considering 
the following:

    '/users/:id[int]'
    '/users/:id(int)'
    '/users/:id:int'
    '/users/:id=int'

Any feedback on what's a good way to go that will be simple and obvious to 
someone reading the code? If a well-known library is already doing 
something like this I'll go with whatever the community is using. Votes 
welcome..


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