Created
May 20, 2024 10:53
-
-
Save Gaurav8757/c69ca224a2bac997e7affb2fe3f3fb71 to your computer and use it in GitHub Desktop.
ES6 .ENV code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import dotenv from "dotenv"; | |
| dotenv.config(); | |
| const {CORS, CORS1, CORSLOCAL} = process.env; | |
| const corsOptions = { | |
| origin: [CORS, CORS1, CORSLOCAL], // Specify trusted domains | |
| methods: ['GET', 'POST'], // Specify allowed methods | |
| allowedHeaders: ['Content-Type', 'Authorization'] // Specify allowed headers | |
| }; | |
| app.use(cors(corsOptions)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment