aboutsummaryrefslogblamecommitdiffstats
path: root/src/nodejs/no1.js
blob: feb3dfb0bfcfa2122754926dd30aca5ec3ffaef3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                                                                   
var clutch = require('clutch');

function helloSomeone(req, res, name,bbox, key, value) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('obj:'+name+ ' bbox: '+ bbox + ' key:' +key +' value:'+value+'!\n');
}

function helloWorld(req, res) {
    helloSomeone(req, res, 'World');
}

myRoutes = clutch.route404([['GET /hello/(\\w+)(\\[bbox=(\\d,\\d,\\d,\\d)\\])*\\[(\\w+)=(\\w+)\\]$', helloSomeone],
                                ['GET /hello/$', helloWorld]]);


var http = require('http');
http.createServer(myRoutes).listen(3000, '127.0.0.1');