Skip to content

Instantly share code, notes, and snippets.

@jazzyjackson
Last active November 24, 2015 06: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 jazzyjackson/6ae764d24ead285f9ba1 to your computer and use it in GitHub Desktop.
Save jazzyjackson/6ae764d24ead285f9ba1 to your computer and use it in GitHub Desktop.
var server = require('http').createServer(handler)
var fs = require('fs')
server.listen(80)
function handler(request, response) {
fs.readFile(__dirname + '/index.html',
function (err, data) {
if (err) {
response.writeHead(500)
return response.end('Error loading index.html')
}
response.writeHead(200)
response.end(data)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment