npm i @choewy/nestjs-bootstrap
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();
@Module({
controllers: [AppController],
providers: [AppService],
})
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer.apply(HttpLogMiddleware).forRoutes('*');
}
}
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(HttpLogMiddleware.use);
await app.listen(3000);
}
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(HttpLogMiddleware.use);
app.useGlobalInterceptors(new HttpLoggingInterceptor());
await app.listen(3000);
}