wbhob / nest-middlewares

Common, injectable middlewares for NestJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

express-session typeorm store

FallenRiteMonk opened this issue · comments

It would be nice to have a Store implementation for typeorm in the express-session middleware.

Can you go into more detail please? I don't really understand your implementation. If you can, I'd love to see a pull request for this since this is a little bit out of my wheelhouse.

One can configure the express-session middleware to use different stores where the session data gets saved. The default is a MemoryStore, which according to express-session should not be used in production.

Since this is a wrapper around express-session for nestjs and the easiest way (according to documentation) to add a database to a nestjs backend is typeorm, it would be great to be able to easily configure express-session to use typeorm to save the data into a database. This would make it possible to use the same database as for the rest of the backend, with the same connection to the database (no additional configuration, plugin or so is required) and since typeorm is not bound to one database once can easily switch between databases (from mysql to mongo for example).

I'm asking this because I would need it for a project and just got started witch nestjs, therefor I have still allot to learn, and so I was hoping that somebody could easily implement this. If not I will be forced to sooner or later do it my self. If nothing come up until then, I'll post a PR.

the express-session wrapper uses the same config as the library, just use the configure method. does that answer your question?