Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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