mirror of
https://github.com/docmost/docmost.git
synced 2025-11-17 03:21:20 +10:00
40 lines
988 B
TypeScript
40 lines
988 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { AppModule } from './app.module';
|
|
import {
|
|
FastifyAdapter,
|
|
NestFastifyApplication,
|
|
} from '@nestjs/platform-fastify';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
import { TransformHttpResponseInterceptor } from './interceptors/http-response.interceptor';
|
|
import fastifyMultipart from '@fastify/multipart';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create<NestFastifyApplication>(
|
|
AppModule,
|
|
new FastifyAdapter({
|
|
ignoreTrailingSlash: true,
|
|
ignoreDuplicateSlashes: true,
|
|
} as any),
|
|
);
|
|
|
|
app.setGlobalPrefix('api');
|
|
|
|
await app.register(fastifyMultipart as any);
|
|
|
|
app.useGlobalPipes(
|
|
new ValidationPipe({
|
|
whitelist: true,
|
|
stopAtFirstError: true,
|
|
transform: true,
|
|
}),
|
|
);
|
|
app.enableCors();
|
|
|
|
app.useGlobalInterceptors(new TransformHttpResponseInterceptor());
|
|
app.enableShutdownHooks();
|
|
|
|
await app.listen(process.env.PORT || 3000);
|
|
}
|
|
|
|
bootstrap();
|