[英]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 eg 我的节点服务器仅使用一种路由:GET / I / want / title此路由需要查询字符串格式的网站地址列表,例如
/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. 单个和多个请求将仅使用一条路由。
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(',');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.