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.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…