diff options
author | slomo <steve.harrison@gmx.net> | 2011-01-12 22:58:31 +0100 |
---|---|---|
committer | slomo <steve.harrison@gmx.net> | 2011-01-12 22:58:31 +0100 |
commit | 2d370398fe8b2329736d839504999186a1aee0aa (patch) | |
tree | 20a11acb9583a7e2846208aa5115eef3b873091c /src/nodejs/no1.js | |
parent | 280179806ad4426480032769f5296d3875044530 (diff) | |
download | osm-xapi-2d370398fe8b2329736d839504999186a1aee0aa.tar.gz osm-xapi-2d370398fe8b2329736d839504999186a1aee0aa.tar.xz osm-xapi-2d370398fe8b2329736d839504999186a1aee0aa.zip |
some new tries
Diffstat (limited to '')
-rw-r--r-- | src/nodejs/no1.js | 17 |
1 files changed, 17 insertions, 0 deletions
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'); |