Skip to content

Instantly share code, notes, and snippets.

@edorgeville
Last active August 29, 2015 14:11
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 edorgeville/4ed6534c5d15c471fe29 to your computer and use it in GitHub Desktop.
Save edorgeville/4ed6534c5d15c471fe29 to your computer and use it in GitHub Desktop.
Hello Node.js
.DS_Store
node_modules/
*.log
var http = require('http');
var port = process.env.PORT || 3000;
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
// Listen on port 3000, IP defaults to 127.0.0.1
server.listen(port);
// Put a friendly message on the terminal
console.log("Server running at http://127.0.0.1:" + port + "/");
{
"name": "4ed6534c5d15c471fe29",
"version": "1.0.0",
"main": "app.js"
}
web: node app.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment