From f3c084069f9ac47d0bb3966f7fe2c98703c629bc Mon Sep 17 00:00:00 2001 From: caadiq Date: Wed, 21 Jan 2026 15:44:36 +0900 Subject: [PATCH] =?UTF-8?q?refactor(backend):=20Scalar=20UI=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20=EB=B0=8F=20API=20=EB=AC=B8=EC=84=9C=20=ED=8F=AC?= =?UTF-8?q?=ED=84=B8=EC=9A=A9=20CORS=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - /docs 라우트(Scalar UI) 제거 → docs.caadiq.co.kr에서 통합 제공 - /docs/json 엔드포인트에 CORS 헤더 추가 Co-Authored-By: Claude Opus 4.5 --- backend/src/app.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) 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(); });