Skip to content

Instantly share code, notes, and snippets.

@wardbell
Created November 12, 2014 16:22
Show Gist options
  • Save wardbell/21bf82fe97c5095834b3 to your computer and use it in GitHub Desktop.
Save wardbell/21bf82fe97c5095834b3 to your computer and use it in GitHub Desktop.
Simplest Node Server In The Universe
var http = require('http');
http.createServer(function (req, res) {
console.log('Got a request: '+req.method+' '+req.url);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
})
.listen(1337, 'localhost'); // 127.0.0.1
console.log('Server running at http://localhost:1337/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment