expressjs / expressjs/session

automatically add .createSession(), .load(), and .regenerate() to Store

Open
#351 2 comments 0 reactions 0 assignees View on GitHub
discuss future ideas
Dominant language
JavaScript
Stars
6.4k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

As explained in #349, developers who want to write their own Store implementation for express-session face one of two choices:
1. include express-session as a dependency and extend their Store from store.js
2. reimplement the functionality of store.js, session.js, and cookie.js (or copy the files from express-session, which amounts to including it as a dependency, but without the benefit of avoiding redundant code)

For many people (myself included), I expect neither of these options is appealing. So instead of requiring the Store implementation to include .createSession(), .load(), and .regenerate(), I suggest that these methods be added to the Store object by express-session on initialization, similar to the way that .generate() is added to the Store [here](https://github.com/expressjs/session/blob/master/index.js#L157). Couldn't .createSession(), .load(), and .regenerate() be added to the Store in the same way?

These methods could either be moved to index.js like .generate(), or generate() could be moved to store.js, and the methods in store.js could be added to the Store on initialization.

I'm happy to create a PR if this is an improvement you'd like to see implemented.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.