Thursday, March 5, 2020

First Node JS Webserver

I have started studying  Node.js® : JavaScript runtime built on Chrome's V8 JavaScript engine using online sources. The below is from the book Up and Running Node JS.
Hope to create a mini project sometime.













Below is the code: 

var http = require('http'); 
http.createServer(function (req, res) { 
    res.writeHead(200, {'Content-Type': 'text/plain'}); 
    res.end('Hello World\n'); 
}).listen(8124, "127.0.0.1"); 
console.log('Server running at http://127.0.0.1:8124/');

No comments:

Post a Comment