1.0.0 • Published 5 years ago

@nestpress/passport v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

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();