var url = require('url');
const http = require('http');
const PORT = process.env.PORT || 8080;
http.createServer((req, res) => {
const queryObject = url.parse(req.url,true).query;
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(queryObject.age + ' ' + queryObject.name);
}).listen(PORT, () => console.log(`Server started on port ${PORT}`));
/*
run:
Server started on port 8080
On http://localhost:8080/?age=48&name=Tom
48 Tom
*/