controller and vsorc data viewers done
[VSoRC/.git] / node_modules / express-ws / examples / params.js
diff --git a/node_modules/express-ws/examples/params.js b/node_modules/express-ws/examples/params.js
new file mode 100644 (file)
index 0000000..b982a59
--- /dev/null
@@ -0,0 +1,26 @@
+var express = require('express');
+var expressWs = require('..');
+
+var expressWs = expressWs(express());
+var app = expressWs.app;
+
+app.param('world', function (req, res, next, world) {
+  req.world = world || 'world';
+  return next();
+});
+
+app.get('/hello/:world', function(req, res, next){
+  console.log('hello', req.world);
+  res.end();
+  next();
+});
+
+app.ws('/hello/:world', function(ws, req, next) {
+  ws.on('message', function(msg) {
+    console.log(msg);
+  });
+  console.log('socket hello', req.world);
+  next();
+});
+
+app.listen(3000)