Created
February 7, 2013 10:37
-
-
Save TeeTeeHaa/4730166 to your computer and use it in GitHub Desktop.
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
// Example code straight from http://nodejs.org/ front page, slightly modified. | |
// Run with node.js (e.x. v.0.8.11 on Windows 7) and open website (once) with | |
// a browser which uses keep-alive connections (e.x. Firefox 18.0 on Windows 7). | |
// The program will not finish until the browser is closed :( because of the | |
// kept-alive connection. Not knowing that reason, how to debug the cause for | |
// the "not finishing" of the program? | |
var http = require('http'); | |
var server = http.createServer(function(req, res) | |
{ | |
res.writeHead(200, { 'Content-Type': 'text/plain' }); | |
res.end('Hello World\n'); | |
server.close(); // close server gracefully | |
}).listen(1337, '127.0.0.1'); | |
console.log('Server running at http://127.0.0.1:1337/'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment