0.0.14 • Published 3 months ago

@choewy/nestjs-bootstrap v0.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

NestJS Bootstrap

Installing

npm i @choewy/nestjs-bootstrap

Uses

createBootstrapOptions

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

  app.useGlobalInterceptors(...bootstrapOptions.interceptors);
  app.useGlobalPipes(...bootstrapOptions.pipes);

  await app.listen(3000);
}

bootstrap();

HttpLogMiddleware

Applying middleware

@Module({
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer.apply(HttpLogMiddleware).forRoutes('*');
  }
}

Functional middleware

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

  app.use(HttpLogMiddleware.use);

  await app.listen(3000);
}

HttpLogInterceptor

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

  app.use(HttpLogMiddleware.use);
  app.useGlobalInterceptors(new HttpLoggingInterceptor());

  await app.listen(3000);
}
0.0.14

3 months ago

0.0.10

3 months ago

0.0.11

3 months ago

0.0.12

3 months ago

0.0.13

3 months ago

0.0.3

3 months ago

0.0.9

3 months ago

0.0.8

3 months ago

0.0.5

3 months ago

0.0.4

3 months ago

0.0.7

3 months ago

0.0.6

3 months ago

0.0.2

3 months ago

0.0.1

3 months ago

0.0.0

3 months ago