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 31s
Anatid Blog CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/anatid-blog-backend, ./backend) (push) Successful in 52s
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 21s

Another go at cors
This commit is contained in:
Phill Pover 2025-03-28 15:38:57 +00:00
parent a58bb6b8dc
commit 84ad2b7684

View File

@ -1,18 +1,13 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
const corsOptions = {
origin: 'https://blog.anatid.net',
methods: 'GET,POST,PATCH,DELETE,OPTIONS',
optionsSuccessStatus: 200
};
async function bootstrap() {
const app = await NestFactory.create(AppModule);
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
origin: ['https://blog.anatid.net'],
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
credentials: true,
allowedHeaders: 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept, Observe', // Allowed headers
});
await app.listen(process.env.PORT ?? 3000);