node/express example gives error
Closed this issue · 1 comments
running the example (example/express) as is gives the error:
TypeError: Path must be a string. Received null at assertPath (path.js:8:11) at posix.join (path.js:479:5) at exports.send (/home/derek/development/sockjs/sockjs-node/examples/express/node_modules/connect/lib/middleware/static.js:129:20) at ServerResponse.res.sendfile (/home/derek/development/sockjs/sockjs-node/examples/express/node_modules/express/lib/response.js:186:3) at /home/derek/development/sockjs/sockjs-node/examples/express/server.js:22:9 at callbacks (/home/derek/development/sockjs/sockjs-node/examples/express/node_modules/express/lib/router/index.js:272:11) at param (/home/derek/development/sockjs/sockjs-node/examples/express/node_modules/express/lib/router/index.js:246:11) at pass (/home/derek/development/sockjs/sockjs-node/examples/express/node_modules/express/lib/router/index.js:253:5) at Router._dispatch (/home/derek/development/sockjs/sockjs-node/examples/express/node_modules/express/lib/router/index.js:280:5) at Object.Router.middleware [as handle] (/home/derek/development/sockjs/sockjs-node/examples/express/node_modules/express/lib/router/index.js:45:10)
To reproduce:
fresh clone of sockjs-node, then run:
cd sockjs-node/examples/express
npm install
npm start
browse to localhost:9999
Fix: update express to latest in package.json
+ "express": "^4.10.2",
- "express": "<3",
Update server.js to new express syntax:
var express = require('express');
var app = express();
var sockjs = require('sockjs');
Behavior observed on both with both node 4.6.1 and node 6.3.1 (but likely others)
That example was built for express 2.x
, so if you want to add a separate one for express 4.x
, that would be appreciated. We could probably rename the directory to be clear about that.