17 lines
465 B
JavaScript
17 lines
465 B
JavaScript
import dotenv from 'dotenv';
|
|
import * as path from "node:path";
|
|
|
|
const envFile = `.env`;
|
|
dotenv.config({ path: path.resolve(process.cwd(), envFile), override: true });
|
|
|
|
const allowedOrigin = process.env.ALLOWED_ORIGIN || 'http://localhost:4200';
|
|
|
|
const corsOptions = {
|
|
origin: allowedOrigin,
|
|
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
|
|
allowedHeaders: ['Content-Type', 'Authorization'],
|
|
credentials: true,
|
|
};
|
|
|
|
export default corsOptions;
|