Skip to content

Instantly share code, notes, and snippets.

@nikhilm nikhilm/greeting.js
Created Feb 6, 2011

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.end("You aren't allowed here!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.