Learning the node for backend web application enables makes you the full stack web developer. Using node for backend web application will leverage the strength of asynchronous and even driven nature of javascript
An example of hello world web application
const http = require('http');
const requestListener = function (req, res) {
res.writeHead(200);
res.end('Hello, World! Welcome');
}
const server = http.createServer(requestListener);
server.listen(8090);
To run the above code, assuming it is saving into app.js
node app.js
Running server can be verified using curl
curl localhost:8090
Explanation of the code
http.createServer function take the function which takes request, and response as arguments. When request is received requestListener function will be called
To listen on port 8090, call server.listen(8090)