Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
SyncOptions,
} from 'create-nestjs-middleware-module';
import * as expressSession from 'express-session';
import { createRetriesMiddleware } from './retriesMiddleware';
interface Options {
session: expressSession.SessionOptions;
retries?: number;
retriesStrategy?: Parameters[2];
}
export type NestSessionOptions = SyncOptions;
export type NestSessionAsyncOptions = AsyncOptions;
export const SessionModule = createModule(options => {
const { retries, session, retriesStrategy } = options;
let middleware = expressSession(session);
if (retries !== undefined) {
middleware = createRetriesMiddleware(middleware, retries, retriesStrategy);
}
return middleware;
});