Here, I am trying to write a program in node.js to parse the given url.Basically here it should show if the connection is established or not . once it shows the connection the established,it should request for the url to parsed , all this would happen in the command prompt. Then when we go on the page it would show- The parse url is:"url". But currently the connection gets established but its not requesting for the url to be parsed.
var port = 5050;
var http = require('http');
var server = http.createServer(function (req, res) {
if (req.url !== '/favicon.ico' && req.url !== '/') {
console.log('Requested URL: ' + req.url);
}
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write("The Parse url is : " + req.url);
res.end();
});
server.listen(port, function () {
console.log('Server running at http://localhost:5050/');
});