Node.js : Express app.get with multiple query parameters

前端 未结 3 1381
渐次进展
渐次进展 2021-02-06 03:28

I want to query the yelp api, and have the following route:

app.get(\"/yelp/term/:term/location/:location\", yelp.listPlaces)

When I make a GET

3条回答
  •  醉酒成梦
    2021-02-06 04:24

    I want to add to @luto's answer. There is no need to define query string parameters in the route. For instance the route /a will handle the request for /a?q=value.

    The url parameters is a shortcut to define all the matches for a pattern of route so the route /a/:b will match

    1. /a/b
    2. /a/c
    3. /a/anything

    it wont match

    /a/b/something or /a

提交回复
热议问题