How to use the create-nestjs-middleware-module.createModule function in create-nestjs-middleware-module

To help you get started, we’ve selected a few create-nestjs-middleware-module examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iamolegga / nestjs-session / src / index.ts View on Github external
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;
});

create-nestjs-middleware-module

NestJS configured middleware module made simple

MIT
Latest version published 1 year ago

Package Health Score

54 / 100
Full package analysis

Popular create-nestjs-middleware-module functions