Skip to content

Instantly share code, notes, and snippets.

@danielkhan danielkhan/simpleServer.js
Last active Aug 29, 2015

What would you like to do?
// 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
}).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
You can’t perform that action at this time.