Wednesday, 19 August 2020

node js webserver

on my pc im running a dev website on localhost with node this is the code:var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.write("hello world"); res.end(); }).listen(8080); then i changed the code to:var http = require('http'); var dt = require('./date'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.write("The date and time are currently: " + dt.myDateTime()); res.end(); }).listen(8080); restarted node in cmd ran it again but the localhost is showing the same thing (hello world)any fix?

Submitted August 19, 2020 at 03:52PM by seruZ12

No comments:

Post a Comment