Skip to content

Instantly share code, notes, and snippets.

@georgioupanayiotis
Created February 8, 2017 12:01
Show Gist options
  • Save georgioupanayiotis/f331d94ce0ff1a93d2de1860522df025 to your computer and use it in GitHub Desktop.
Save georgioupanayiotis/f331d94ce0ff1a93d2de1860522df025 to your computer and use it in GitHub Desktop.
Node.js - Intro Hello World example
var http = require("http");
http.createServer(function (request, response) {
// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});
// Send the response body as "Hello World"
response.end('Hello World\n');
}).listen(8081);
// Console will print the message
console.log('Server running at http://127.0.0.1:8081/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment