So I created a module for node js and connected it to the main file, then ran the server in localhost:8080. The code ran but, this happened-
this is the code for the main node.js file-
var http = require('http');
var dt = require('./demo_module.js');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write("Date and time:" + dt.myDateTime)
res.end('Hello World!');
}}.listen(8080;)
The code for module-
exports.myDateTime = function () {
return Date();
};