Now that the database is in place and we know how to browse collections and data in the database, we can start creating a backend powered by Node.js. To get your website to run on Node.js, all you need to do is create a JavaScript file and load it using Node. Node provides some packages that are at your disposal by using require as we have done before. The Node.js website had some Hello, Node.js! script on their website, but it was removed when the platform got more mature and the user base grew. Luckily, I still have it laying around somewhere and so we will create our first Node.js website. Put the following JavaScript code in a new file and name it index.js:
var http = require('http');
var server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello, Node...