javascript - Is there a way to do dynamic key/value parameters in url route in express.js -


i looking way (and hoping there 1 available already) read dynamically routed parameters in nodejs. (like way zend framework 1 default router did).

so want have this:

app.get('/resource/:key/:value/:anotherkey/:differentvalue', function(req, res) {     return res.send('this print :differentvalue: '+req.params.anotherkey); }); 

but without having define different keys , values

i use querystring particular usecase.

so given url this: myapp.com/search/?filter_one=param&filter_two=param2

and use url module in node.

var url = require('url'); var parsed_url = url.parse(request.url, true); var querystring_object = parsed_url.query //{filter_one: "param", filter_two: "param2"} //and object quite easier hand off elastic search 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -