I have a request being sent to the server:
"/stuff?a=a&b=b&c=c"
Using express, how do I get these values?
I have tried the following...
app.get( "/stuff?:a&:b&:c", function( req, res ){});
...however it does not seem to recognize the route.
Thanks (in advance) for your help.
The querystring. parse() method is used to parse a URL query string into an object that contains the key and pair values of the query URL. The object returned does not inherit prototypes from the JavaScript object, therefore usual Object methods will not work.
The Query String module provides a way of parsing the URL query string.
It's not a good idea to use a query string inside a route.
In Express logic you need create a route for "/stuff". The query string will be available in req.query
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With