var require("http");
var server = http.createServer(function(req, res) {
res.writeHead(200, {"Content-Type": "text/plain"});
// 200 : successful // text/html for html
res.end("Hello World");
});
server.listen(3000); // port 3000
console.log("Server listening on port 3000");
(...)
var server = http.createServer(function(req, res) {
res.writeHead(200, {"Content-Type": "text/html"});
res.end(`
HTML Response
${req.url}
${req.method}
Serving HTML text
`);
});
(...)