Created
February 2, 2012 18:12
-
-
Save clonn/1724926 to your computer and use it in GitHub Desktop.
node.js, simple routing process
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 server, ip = "127.0.0.1", | |
port = 1337, | |
http = require('http'), | |
url = require('url'); | |
server = http.createServer(function (req, res) { | |
console.log(req.url); | |
res.writeHead(200, { | |
'Content-Type': 'text/plain' | |
}); | |
res.end('hello world\n'); | |
}); | |
server.listen(port, ip); | |
console.log("Server running at http://" + ip + ":" + port); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment