I know how to get the params for queries like this:
app.get('/sample/:id', routes.sample);
In this case, I can use req.params.id
to get the parameter (e.g. 2
in /sample/2
).
However, for url like /sample/2?color=red
, how can I access the variable color
?
I tried req.params.color
but it didn't work.
转载于:https://stackoverflow.com/questions/17007997/how-to-access-the-get-parameters-after-in-express