strongloop-archive / strong-gateway-demo

DEPRECATED | Our new gateway product is available at https://github.com/strongloop/microgateway.
Other
35 stars 34 forks source link

how setup redis session in middleware #13

Open PanYuntao opened 8 years ago

PanYuntao commented 8 years ago

Hi~ all , this is my code in server.js ,NODE_ENV=dev run it's ok,but NODE_ENV=pro Warning: connect.session() MemoryStore is not designed

app.middleware('session:before', app.loopback.cookieParser("abc"));
var store =new redisstore({
  host: "127.0.0.1",
  port: "6379",
  pass: "secret",
  ttl:  "3600"
});
if (require.main === module) {
  store.client.unref();
}
app.middleware('session', loopback.session({
  saveUninitialized: true,
  resave: true,
  key: "secret",
  store:store ,
  "secret": "secret"
}));