Skip to content

Instantly share code, notes, and snippets.

@indutny
Created December 10, 2011 16:29
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 indutny/1455514 to your computer and use it in GitHub Desktop.
Save indutny/1455514 to your computer and use it in GitHub Desktop.
Simple web-server script
var http = require('http');
http.createServer(function(req, res) {
if (req.url === '/') {
// Index page
res.end('hello world');
} else {
// Favicon and everything else
res.writeHead(400);
res.end('not found');
}
}).listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment