import Cors from 'cors'; function initMiddleware(middleware) { console.log("CORS initMiddleware !!!!"); return (req, res) => new Promise((resolve, reject) => { middleware(req, res, (result) => { if (result instanceof Error) { return reject(result); } return resolve(result); }); }); } // Initialize the cors middleware const cors = initMiddleware( // You can read more about the available options here: https://github.com/expressjs/cors#configuration-options Cors({ origin: ["http://localhost:3000", "https://lk-evo.quickcode.ru"], // Only allow requests with GET, POST and OPTIONS methods: ['GET', 'POST', 'OPTIONS'], }) ) export { cors };