Spaces:
Sleeping
Sleeping
Download src/app/api/docs/route.ts from tao-shen/HuggingClaw-MissionControl: direct link, hf CLI and curl.
- Browser
- Download file 464 Bytes
-
https://huggingface.co/spaces/tao-shen/HuggingClaw-MissionControl/resolve/main/src/app/api/docs/route.ts
- Command line
-
hf download hf://spaces/tao-shen/HuggingClaw-MissionControl/src/app/api/docs/route.ts
-
curl -L -o route.ts https://huggingface.co/spaces/tao-shen/HuggingClaw-MissionControl/resolve/main/src/app/api/docs/route.ts
464 Bytes
| import { NextResponse } from 'next/server' | |
| import { readFileSync } from 'fs' | |
| import { join } from 'path' | |
| let cachedSpec: string | null = null | |
| export async function GET() { | |
| if (!cachedSpec) { | |
| const specPath = join(process.cwd(), 'openapi.json') | |
| cachedSpec = readFileSync(specPath, 'utf-8') | |
| } | |
| return new NextResponse(cachedSpec, { | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| 'Cache-Control': 'public, max-age=3600', | |
| }, | |
| }) | |
| } | |