From 97baff32fd82630497d761f36b5e34466f8ecbc1 Mon Sep 17 00:00:00 2001 From: slomo Date: Wed, 12 Jan 2011 22:58:31 +0100 Subject: some new tries --- src/nodejs/no1.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/nodejs/no1.js (limited to 'src/nodejs/no1.js') diff --git a/src/nodejs/no1.js b/src/nodejs/no1.js new file mode 100644 index 0000000..feb3dfb --- /dev/null +++ b/src/nodejs/no1.js @@ -0,0 +1,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'); -- cgit v1.2.3