diff options
| author | Ritesh Ghosh <[email protected]> | 2024-10-04 12:24:31 +0530 |
|---|---|---|
| committer | Ritesh Ghosh <[email protected]> | 2024-10-04 12:24:31 +0530 |
| commit | 21a8718f87d7409d61970139e39c2bb0c6cfe91c (patch) | |
| tree | 3490848a3c263e152a554fa501c96f0b7b6763dd /src | |
| parent | e30d98399657600b33cd841da5df472e766be21a (diff) | |
| download | aniwatch-api-21a8718f87d7409d61970139e39c2bb0c6cfe91c.tar.xz aniwatch-api-21a8718f87d7409d61970139e39c2bb0c6cfe91c.zip | |
feat: update allowed origins to include wildcard if env not present
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/cors.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/config/cors.ts b/src/config/cors.ts index 9cbf836..8089522 100644 --- a/src/config/cors.ts +++ b/src/config/cors.ts @@ -1,11 +1,11 @@ -import cors from 'cors'; -import dotenv from 'dotenv'; +import cors from "cors"; +import { config } from "dotenv"; -dotenv.config(); +config(); const allowedOrigins = process.env.CORS_ALLOWED_ORIGINS ? process.env.CORS_ALLOWED_ORIGINS.split(",") - : ["http://localhost:4000"]; + : ["http://localhost:4000", "*"]; const corsConfig = cors({ origin: function (origin, callback) { @@ -16,10 +16,9 @@ const corsConfig = cors({ } }, methods: ["GET"], + maxAge: 600, credentials: true, optionsSuccessStatus: 200, - maxAge: 600, }); export default corsConfig; - |
