javascript - Dynamic routes with static parts on express js -


i'm trying path express catches types of url:

/events/0.json 

what i've tried is... (and it's not correct):

router.put('/events.json/:id.json', islogged, events.update); 

is possible express?

yes, catch pattern x.json x 1 or more characters.

so /events/0.json save '0' in req.params.id. note id string, not number. have convert if want number number arithmetic or put in database number/int type


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -