
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
typeorm-store
Advanced tools
A TypeORM-based store for express-session.
$ yarn add typeorm-store
First, make a new Session
entity. Make sure to synchronize the entity to the database. typeorm-store
will not to this for you.
import { BaseEntity, Column, Entity, PrimaryColumn } from 'typeorm';
import { SessionEntity } from 'typeorm-store';
@Entity()
export class Session extends BaseEntity implements SessionEntity {
@PrimaryColumn()
id: string;
@Column()
expiresAt: number;
@Column()
data: string;
}
Use TypeormStore
as store in express-session
, specifying the repository of the new Session
entity.
import * as express from 'express';
import * as session from 'express-session';
import { getConnection } from 'typeorm';
import { TypeormStore } from 'typeorm-store';
import { Session } from './entities/session';
const app = express();
// Make sure the connection is ready before doing this
const repository = getConnection().getRepository(Session);
app.use(session({
secret: 'secret',
resave: false,
saveUninitialized: false,
store: new TypeormStore({ repository })
}))
new TypeormStore(options)
repository
(required) - The repository of the session entity.ttl
(optional) - The time to live for the session in seconds. Defaults to 86400 (1 day).expirationInterval
(optional) - The interval in seconds to check for expired sessions.
Defaults to 86400 (1 minute).FAQs
A TypeORM-based store for express-session
The npm package typeorm-store receives a total of 382 weekly downloads. As such, typeorm-store popularity was classified as not popular.
We found that typeorm-store demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.