Secbone / koa-session2

Middleware for Koa2 to get/set session
MIT License
153 stars 30 forks source link

Add connection config in Store.js #21

Closed teabore closed 7 years ago

teabore commented 7 years ago

Store.js uses the default Redis connection. Add this change to allow custom configuration:

Store.js

constructor(opts) {
    super();
    this.redis = new Redis(opts);
}

main.js

app.use(session({
    store: new Store({
      host: some.host.or.ip
    })
}));
Secbone commented 7 years ago

@teabore It's just an example to show how to use the Store, you can create your own Store class in your projects, just extends Store and then do whatever you want. :)