30 lines
948 B
TypeScript
30 lines
948 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { AppModule } from './app.module';
|
|
import { NestFastifyApplication, FastifyAdapter } from '@nestjs/platform-fastify';
|
|
import { FastifyContextConfig } from 'fastify';
|
|
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
|
|
|
async function bootstrap() {
|
|
const fastifyAdapter=new FastifyAdapter({
|
|
listeningOrigin: "0.0.0.0",
|
|
crossOriginIsolated: true
|
|
|
|
} as FastifyContextConfig);
|
|
|
|
const app = await NestFactory.create<NestFastifyApplication>(AppModule, fastifyAdapter);
|
|
|
|
app.enableCors();
|
|
|
|
const config = new DocumentBuilder()
|
|
.setTitle('Ritzenbergen API')
|
|
.setDescription('The Ritzenbergen API description')
|
|
.setVersion('1.0')
|
|
.addTag('ritzenbergen')
|
|
.build();
|
|
const document = SwaggerModule.createDocument(app, config);
|
|
SwaggerModule.setup('/api/docs', app, document);
|
|
|
|
await app.listen(process.env.PORT ?? 3000, "0.0.0.0");
|
|
}
|
|
bootstrap();
|