Domanda

Since I'm not intimately familiar with Express, can anybody tell me why v4.0.0 doesn't include --sessions as a command?

When I use version 3.4.8 this command is supported, but when I grab the newest version, I run into 2 issues:

  1. The Express.cmd isn't generated (I'm running on Win8.1 x64) - Therefore I had to run npm install express-generator
  2. No included support for the --sessions command

I might also be missing something and this was an intentional separation done by the Express team?

È stato utile?

Soluzione

Connect middleware is no longer bundled with express. You have to install the session middleware yourself in express 4.x. For a decent guide on updating see this post.

%npm install express-session

then

var session = require ('express-session');

and replace

app.use(express.session());

with

app.use(session({secret: 'keyboard cat', cookie: { maxAge: 100000 }}));
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top