Changes
This commit is contained in:
16
src/plugins/cors.ts
Normal file
16
src/plugins/cors.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { FastifyInstance } from "fastify";
|
||||
import fp from "fastify-plugin";
|
||||
import cors from "@fastify/cors";
|
||||
|
||||
export default fp(async (server: FastifyInstance) => {
|
||||
await server.register(cors, {
|
||||
origin: [
|
||||
"http://localhost:3000", // dein Nuxt-Frontend
|
||||
"http://127.0.0.1:3000", // dein Nuxt-Frontend
|
||||
],
|
||||
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
||||
allowedHeaders: ["Content-Type", "Authorization", "Context"],
|
||||
exposedHeaders: ["Authorization"], // optional, falls du ihn auch auslesen willst
|
||||
credentials: true, // wichtig, falls du Cookies nutzt
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user