Last active
August 29, 2015 14:11
-
-
Save edorgeville/4ed6534c5d15c471fe29 to your computer and use it in GitHub Desktop.
Hello Node.js
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
.DS_Store | |
node_modules/ | |
*.log |
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
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 + "/"); |
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
{ | |
"name": "4ed6534c5d15c471fe29", | |
"version": "1.0.0", | |
"main": "app.js" | |
} |
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
web: node app.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment