aboutsummaryrefslogtreecommitdiffstats
path: root/src/nodejs/no1.js
diff options
context:
space:
mode:
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');