0

I'm stuck at using cors in Qwik.

In Next, I would use this code snippet:

const cors = Cors({
  methods: ['POST', 'GET', 'HEAD'],
})

function runWithCors(req, res, callback) {
  return new Promise((resolve, reject) => {
    callback(req, res, result => {
      if (result instanceof Error) {
        return reject(result)
      }

      return resolve(result)
    })
  })
}

Yet in Qwik's Endpoints, I only have access to the requestEvent.

What should I do?

Ali Radan
  • 117
  • 5
  • You can use express server to handle cors just like normal express application. – Harsh Mangalam Aug 29 '23 at 03:20
  • @HarshMangalam now i'm using Express for deploy Qwik Application, in `entry.express.tsx` file, and import cors above the file: `import cors from 'cors'` and use cors with this command: `app.use(cors());` but not working and give cors error on requests – Ali Radan Aug 31 '23 at 15:15

0 Answers0