I have the following code
const session = require("express-session")
const { createClient } = require("redis");
const RedisStore = require("connect-redis").default;
// Initialize Redis client
let redisClient = createClient({ url: process.env.REDIS_URL });
redisClient.connect().catch(console.error);
let redisStore = new RedisStore({
client: redisClient,
prefix: "test:",
});
app.use(
session({
store: redisStore,
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: false,
cookie: {
secure: process.env.NODE_ENV === "production",
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24, // 1 day
},
})
);
I'm trying to use connect-redis v9.0 but I get the error
let redisStore = new RedisStore({
^
TypeError: RedisStore is not a constructor
What am I doing wrong?
I recently upgraded my node js version to the latest one so I'm guessing it has to do with that.