Update backend/src/main.ts
All checks were successful
Anatid Blog CI Workflow / test (./backend) (push) Successful in 27s
Anatid Blog CI Workflow / test (./frontend) (push) Successful in 28s
Anatid Blog CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/anatid-blog-backend, ./backend) (push) Successful in 49s
Anatid Blog CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/anatid-blog-frontend, ./frontend) (push) Successful in 44s
Anatid Blog CI Workflow / deploy (push) Successful in 22s

Fixing cors
This commit is contained in:
Phill Pover 2025-03-28 13:27:28 +00:00
parent acfe51c112
commit a58bb6b8dc

View File

@ -8,7 +8,13 @@ const corsOptions = {
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
app.enableCors(corsOptions); app.enableCors({
origin: ['https://blog.anatid.net'], // Allowed origins
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', // Allowed methods
credentials: true, // Allow credentials (e.g., cookies)
allowedHeaders: 'Content-Type, Accept', // Allowed headers
});
await app.listen(process.env.PORT ?? 3000); await app.listen(process.env.PORT ?? 3000);
} }