Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
henriqueweiand committed Mar 7, 2024
1 parent d9fd28f commit f1941e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { ValidationPipe } from '@nestjs/common';

async function bootstrap() {
const app = await NestFactory.create(AppModule, {
snapshot: true,
rawBody: true,
})

const configService = app.get(EnvService)
const port = configService.get('PORT')

function getSwaggerServerUrl() {
switch (process.env.NODE_ENV) {
case 'production':
Expand All @@ -16,11 +21,6 @@ async function bootstrap() {
return `http://localhost:${port}/api`;
}
}

const app = await NestFactory.create(AppModule, {
snapshot: true,
rawBody: true,
})

app.useGlobalPipes(new ValidationPipe({
transform: true,
Expand Down
15 changes: 14 additions & 1 deletion vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
}
],
"routes": [
{
"src": "/api/(.*)",
"dest": "api/(.*)",
"methods": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE",
"HEAD",
"OPTIONS"
]
},
{
"src": "/(.*)",
"dest": "dist/main.js",
Expand All @@ -22,4 +35,4 @@
]
}
]
}
}

0 comments on commit f1941e1

Please sign in to comment.