Skip to content

Instantly share code, notes, and snippets.

@nielk
Last active December 21, 2015 18:49
Show Gist options
  • Save nielk/6350399 to your computer and use it in GitHub Desktop.
Save nielk/6350399 to your computer and use it in GitHub Desktop.
node.js basic server
var http = require('http');
var fs = require('fs');
http.createServer(function(request, response) {
response.writeHead(200,{
'Content-Type':'text/html'
});
fs.readFile('index.html',function(err,contents){
/* response.write(contents);
response.end(); */
response.end(contents); /* short version */
});
}).listen(8008);
console.log('listenning 8008...');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment