diff --git a/backend/src/app.js b/backend/src/app.js index 259eaff..b77c5f7 100644 --- a/backend/src/app.js +++ b/backend/src/app.js @@ -4,7 +4,6 @@ import { fileURLToPath } from 'url'; import Fastify from 'fastify'; import fastifyStatic from '@fastify/static'; import fastifySwagger from '@fastify/swagger'; -import scalarApiReference from '@scalar/fastify-api-reference'; import multipart from '@fastify/multipart'; import config from './config/index.js'; import * as schemas from './schemas/index.js'; @@ -92,19 +91,10 @@ export async function buildApp(opts = {}) { }, }); - // Scalar API Reference UI - await fastify.register(scalarApiReference, { - routePrefix: '/docs', - configuration: { - theme: 'purple', - spec: { - url: '/docs/json', - }, - }, - }); - - // OpenAPI JSON 엔드포인트 - fastify.get('/docs/json', { schema: { hide: true } }, async () => { + // OpenAPI JSON 엔드포인트 (CORS 허용 - API 문서 포털용) + fastify.get('/docs/json', { schema: { hide: true } }, async (request, reply) => { + reply.header('Access-Control-Allow-Origin', 'https://docs.caadiq.co.kr'); + reply.header('Access-Control-Allow-Methods', 'GET'); return fastify.swagger(); });