aboutsummaryrefslogtreecommitdiffstats
path: root/src/nodejs/no1.js
diff options
context:
space:
mode:
authorslomo <steve.harrison@gmx.net>2011-01-12 22:58:31 +0100
committerslomo <steve.harrison@gmx.net>2011-01-12 22:58:31 +0100
commit97baff32fd82630497d761f36b5e34466f8ecbc1 (patch)
tree20a11acb9583a7e2846208aa5115eef3b873091c /src/nodejs/no1.js
parent2cb5dd752037ff81329578d1514dac7de0e3ee16 (diff)
downloadosm-xapi-97baff32fd82630497d761f36b5e34466f8ecbc1.tar.gz
osm-xapi-97baff32fd82630497d761f36b5e34466f8ecbc1.tar.xz
osm-xapi-97baff32fd82630497d761f36b5e34466f8ecbc1.zip
some new tries
Diffstat (limited to 'src/nodejs/no1.js')
-rw-r--r--src/nodejs/no1.js17
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');