//Module to be used http url
Current url http://localhost:8888/select?aa=001&bb=002
var http = require('http');
var URL = require('url');
http.createServer(function(req, res){
var arg = url.parse(req.url).query; //Method 1 arg => aa=001&bb=002
var arg = url.parse(req.url, true).query; //Method 2 arg => { aa: '001', bb: '002' }
console.log(arg.aa);//Return 001
console.log(arg.bb);//Return 002
//Then you can process it based on the obtained data
}).listen(8888);//Establish a server and listen on the port
It is worth noting here that when the statement is var p = URL.parse(testUrl, true), p.query returns an object such as: {aa:'001'}, and printing p.query directly returns [ object Object], then we can write like this: console.log(p.query.aa); //The value obtained is: 001