#Cors in mercurius

6 messages · Page 1 of 1 (latest)

livid scaffold
#

Hello!
How do you enable cors in mercurius? (Usando fastify)

severe pendant
#

Have you used the Fastify Cors package?

livid scaffold
#

Hello @severe pendant ,
I have not used any package at the moment.

I don't know how to implement it with mercurius

severe pendant
#

Ok, Did you first try adding app.enableCors() in the main.ts?

#

alternatively use fastifyCors, always registering it in the main.ts

app.register(fastifyCors, {
    credentials: true,
    origin: 'localhost:4200'
  });  ```