>npm init >npm install http-status-codes
<!DOCTYPE html> <html> <body> <h1>A Warm Hello to You</h1> </body> </html>
//serve-file.js const http = require('http'), fs = require('fs'), httpStatusCodes = require('http-status-codes'), path = 'views/hello.html', port = 3000; const server = http.createServer((req, res) => { res.writeHead(httpStatusCodes.OK, {'Content-Type': 'text/html'}); fs.readFile(path, (err, contents) => { if (err) throw err; res.write(contents); res.end(); }); }); server.listen(port);
>node serve-file