Ad

How To Code One (RESTful) Route With More Than One Parameter

My node server uses one and only one route: GET /I/want/title This route expects a list of websites addresses in query string format e.g.

    /web/=http://bing.com
    /web/?address=http://yahoo.com

This works ok, so how to use one route for both or more?

    yahoo&bing

Only one route will be used for both single and multiple requests.

Ad

Answer

You could use, for example:

/I/want/title/?address=bing.com,www.yahoo.com

And then easily split parameter to array:

var addressesArray = address.split(',');
Ad
source: stackoverflow.com
Ad