Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created May 31, 2017 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/0a02c07ba5f7f1a4fbe4d1123928b6f5 to your computer and use it in GitHub Desktop.
Save kunigami/0a02c07ba5f7f1a4fbe4d1123928b6f5 to your computer and use it in GitHub Desktop.
var http = require('http');
var url = require('url');
var fs = require('fs');
// Read the HTML file
var htmlFile;
fs.readFile('./response.html', function(err, data) {
if (err) {
throw err;
}
htmlFile = data;
});
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.end(htmlFile);
}).listen(3000, "127.0.0.1");
console.log('server running');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment