refactor(backend): Scalar UI 제거 및 API 문서 포털용 CORS 설정
- /docs 라우트(Scalar UI) 제거 → docs.caadiq.co.kr에서 통합 제공 - /docs/json 엔드포인트에 CORS 헤더 추가 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f483f2cf53
commit
f3c084069f
1 changed files with 4 additions and 14 deletions
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue