Created
February 16, 2016 17:58
-
-
Save codingfoo/be42ed6f49ccea99db4d to your computer and use it in GitHub Desktop.
Template for nodjs http server
This file contains hidden or 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'); // require is unique to nodejs | |
var server = http.createServer(function (request, response) { | |
response.writeHead(200, {"Content-Type": "text/plain"}); | |
response.end("Hello World\n"); | |
}); | |
// Listen on port 8080, IP defaults to 127.0.0.1 | |
server.listen(8080); | |
console.log("Server running on http://127.0.0.1:8000/"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment