Skip to content

Instantly share code, notes, and snippets.

@codingfoo
Created February 16, 2016 17:58
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 codingfoo/be42ed6f49ccea99db4d to your computer and use it in GitHub Desktop.
Save codingfoo/be42ed6f49ccea99db4d to your computer and use it in GitHub Desktop.
Template for nodjs http server
var http = require('http'); // require is unique to nodejs
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
// Listen on port 8080, IP defaults to 127.0.0.1
server.listen(8080);
console.log("Server running on http://127.0.0.1:8000/");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment