Skip to content

Instantly share code, notes, and snippets.

@nikhilm
Created February 6, 2011 04:30
Show Gist options
  • Save nikhilm/813128 to your computer and use it in GitHub Desktop.
Save nikhilm/813128 to your computer and use it in GitHub Desktop.
var http = require('http');
http.createServer(function (req, res) {
var result = req.url.match(/^\/user\/([a-z]+)$/);
if( result ) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('<html><head><title>Greeting App</title></head><body><h1>Hello '+ result[1] + '!</h1></body></html>');
}
else {
res.writeHead(403);
res.end("You aren't allowed here!");
}
}).listen(5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment