import { NextResponse } from "next/server"; import { openApiSpec } from "@/lib/openapi"; import { withBasePath } from "@/utils/base-path"; // GET /api/swagger — หน้า Swagger UI ของ API ทั้งหมด (กลุ่ม template + N10) // (asset สำหรับ intranet: postinstall scripts/copy-swagger-ui.mjs คัดลอก // swagger-ui-dist ไป public/note/swagger-ui/ — pattern เดียวกับ pdf.worker) // spec inline จาก lib/openapi.ts ตรง ๆ ไม่มี endpoint spec แยก export const runtime = "nodejs"; // กัน ใน JSON ตัดสคริปต์ขาย (spec เป็นของเราเองทั้งหมด แค่กันกรณี // ข้อความ example มี < ในอนาคต) const SPEC_JSON = JSON.stringify(openApiSpec).replace(/ Swagger UI — Judge's Note API
`; export async function GET() { return new NextResponse(HTML, { headers: { "content-type": "text/html; charset=utf-8" }, }); }