nestjs-package-express-session-auth
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

NestJS Express Session Auth Package

Installation

npm i nestjs-package-express-session-auth

Usage

// auth.module.ts
@Module({
  imports: [
    ExpressSessionAuthModule.forRootAsync({
      imports: [UserModule],
      useFactory: (authService: UserService): IAuthLoginBaseOptions => {
        const pgSession = connectPgSimple(session);
        return {
          authService,
          session: {
            name: 'sid',
            secret: 'secret',
            rolling: true,
            cookie: {
              maxAge: 60 * 1000,
              secure: process?.env?.NODE_ENV === 'production',
              httpOnly: process?.env?.NODE_ENV === 'production',
            },
            store: new pgSession({
              conString: 'postgresql://user:password@localhost:5432/db?schema=public',
            }),
          },
        };
      },
      inject: [UserService],
    }),
  ]
})

Change Log

See Changelog for more information.

Package Sidebar

Install

npm i nestjs-package-express-session-auth

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

24.4 kB

Total Files

21

Last publish

Collaborators

  • tubee