Skip to content

Instantly share code, notes, and snippets.

@danielkhan
Last active August 29, 2015 14:21
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 danielkhan/2eeeddb0eac99559e56d to your computer and use it in GitHub Desktop.
Save danielkhan/2eeeddb0eac99559e56d to your computer and use it in GitHub Desktop.
// Require the http core module
var http = require('http');
// Create a server and provide a function (callback) that
// gets called for every request
http.createServer(function (req, res) {
// Speccify a content type
res.writeHead(200, {'Content-Type': 'text/plain'});
// Write into the response object sent to the client
res.write('Hello World!');
// End the request
res.end();
}).listen(4242); // Tell the HTTP server on which port it should listen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment