0

That's my code:

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

let sess = {
    //store: ,
    secret: cryptoString,
    resave: true,
    saveUninitialized: true,
    cookie: {
        path: '/',
        maxAge: 8 * 60 * 60 * 1000, //h * min * s * ms
    },
    name: 'data',
}

server.use(session(sess)); 

server.post('/lgn', (req, resp) => {
    let session = req.session;
});

I have uploaded my code to heroku and it works. But I get the warning:

"connect.session() MemoryStore is not designed for a production enviroment, as it will leak memory, and will not scale past a single process."

After lots of research I have figured out, that I have to use a store. But which one? I was experimenting with mongo-connect. But without success.

That's what I have added in my code:

const MongoStore = require('connect-mongo')(session);

let sess = {
    //store: new MongoStore(options), //what are the options for back4app?
    ...
}

I don't understand, how to implement it correct and even if it is the right store for back4app? Who has experience with integrating the back4app session in express-session?

listener
  • 47
  • 7
  • Hi @listener, I think that it's better you contact the back4app support team on their website to help you with that... However, you can check this link about the express-session module: https://www.npmjs.com/package/express-session – Charles Oct 10 '19 at 23:49
  • thanks @RamosCharles – listener Oct 11 '19 at 14:22

0 Answers0