Skip to content

Instantly share code, notes, and snippets.

@clonn
Created February 2, 2012 18:12
Show Gist options
  • Save clonn/1724926 to your computer and use it in GitHub Desktop.
Save clonn/1724926 to your computer and use it in GitHub Desktop.
node.js, simple routing process
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