express.io icon indicating copy to clipboard operation
express.io copied to clipboard

Session examples need updating

Open bpytlik opened this issue 10 years ago • 3 comments

Both session examples in the examples directory use the express 3.X approach of express.cookieParser and express.session. Since express was updated to 4.x in May, these examples should be updated to match.

bpytlik avatar Aug 26 '14 23:08 bpytlik

Here's more detail. When I run the example exactly as shown in the examples file, I get:

express.io/lib/index.coffee:226 this._router.stack.push(layer); ^ TypeError: Cannot read property 'stack' of undefined at Function.express.application.io (/aux0/brock/sensor-split/proto.x86_64/opt/default/lib/node_modules/express.io/lib/index.coffee:226:17) at Object. (/aux0/brock/sensor-split/proto.x86_64/opt/default/lib/httpd/server.js:2:24) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3

When I change the code around so it looks like this:

app = express()

// Setup your sessions, just like normal.
app.use(express.cookieParser())
app.use(express.session({secret: 'monkey'}))

app.http().io()

I get this error:

Error: Most middleware (like cookieParser) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware. at Function.Object.defineProperty.get (/aux0/brock/sensor-split/proto.x86_64/opt/default/lib/node_modules/express.io/node_modules/express/lib/express.js:89:13) at Object. (/aux0/brock/sensor-split/proto.x86_64/opt/default/lib/httpd/server.js:6:17) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3

bpytlik avatar Aug 26 '14 23:08 bpytlik

i am getting this error. any solution?

lutfor3737 avatar Feb 04 '16 00:02 lutfor3737

I think the solution is to do what's described here: https://github.com/senchalabs/connect#middleware

bpytlik avatar Feb 04 '16 01:02 bpytlik