tj / connect-redis

Redis session store for Connect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read property 'Store' of undefined (connect redis with express-session)

RomanGodMode opened this issue · comments

package.json dependencies

"connect-redis": "^5.2.0",
"express-session": "^1.17.1",
"@types/express-session": "^1.17.3",
"@types/connect-redis": "^0.0.16"

vain try

import session from 'express-session'
import redis from 'redis'
import connectRedis from 'connect-redis'

const RedisStore = connectRedis(session)//Error here
console.log('We never see this log...')

const redisClient = redis.createClient({
  host: process.env.REDIS_HOST,
  port: +process.env.REDIS_PORT
})

app.use(
    session({
      store: new RedisStore({ client: redisClient }),
      //Other options...
    })
  )

sorry for dumb question, your lib work good,
i don't know what this expressions mean different things:

import connectRedis from 'connect-redis'
//-------------------------------------------------------------
import * as connectRedis from 'connect-redis'

but I don't know how you created a function inside the package. in order to import it this way