npm.io
1.0.0 • Published 7 years ago

@nestpress/passport

Licence
MIT
Version
1.0.0
Deps
0
Size
7 kB
Vulns
0
Weekly
0
Stars
40
DeprecatedThis package is deprecated

@nestpress/passport

The passport initializer module for NestJS

Package License (MIT)

Installation

$ npm install --save @nestpress/passport passport

Usage

In your application main entry point, just use it like below:

import { NestFactory } from '@nestjs/core';
import { PassportModule } from '@nestpress/passport';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  app.get(PassportModule).initialize(app);

  app.listen(3000, '0.0.0.0', () => {
    console.log('Ready on http://localhost:3000');
  });
}

bootstrap();

Options

import { NestFactory } from '@nestjs/core';
import { PassportModule } from '@nestpress/passport';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  // these are default options
  app.get(PassportModule).initialize(app, {
    serializeUserFn: (user: any, cb: any) => cb(null, user),
    deserializeUserFn: (obj: any, cb: any) => cb(null, obj),
  });

  app.listen(3000, '0.0.0.0', () => {
    console.log('Ready on http://localhost:3000');
  });
}

bootstrap();

Keywords