Server SPA from server

* add /api prefix
This commit is contained in:
Philipinho
2023-11-27 13:20:42 +00:00
parent 544e34475b
commit e594074fda
6 changed files with 21 additions and 6 deletions
+7 -1
View File
@@ -6,6 +6,7 @@ import {
} 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>(
@@ -13,9 +14,13 @@ async function bootstrap() {
new FastifyAdapter({
ignoreTrailingSlash: true,
ignoreDuplicateSlashes: true,
}),
} as any),
);
app.setGlobalPrefix('api');
await app.register(fastifyMultipart);
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
@@ -29,4 +34,5 @@ async function bootstrap() {
await app.listen(process.env.PORT || 3001);
}
bootstrap();