Skip to content

Instantly share code, notes, and snippets.

@wardbell
Created November 12, 2014 16:22
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