node js access query string parameters code example
Example 1: expressjs query params
console.dir(req.query.q)
console.dir(req.query.order)
console.dir(req.query.shoe.color)
console.dir(req.query.shoe.type)
console.dir(req.query.color)
Example 2: node js http request get parameters
const http = require('http');
const url = require('url');
http.createServer(function (req, res) {
const queryObject = url.parse(req.url,true).query;
console.log(queryObject);
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('Feel free to add query parameters to the end of the url');
}).listen(8080);