Last active
August 29, 2015 14:21
-
-
Save danielkhan/2eeeddb0eac99559e56d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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