From d238c846a6a4846641492aafd11a55ca53b0602f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Thu, 12 Mar 2026 14:35:10 -0300 Subject: [PATCH] feat: change site.json api route --- apps/site/app/{api => }/site.json/route.ts | 4 +--- docs/site-config.md | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) rename apps/site/app/{api => }/site.json/route.ts (73%) diff --git a/apps/site/app/api/site.json/route.ts b/apps/site/app/site.json/route.ts similarity index 73% rename from apps/site/app/api/site.json/route.ts rename to apps/site/app/site.json/route.ts index ba2b31007e60e..075122daa9f48 100644 --- a/apps/site/app/api/site.json/route.ts +++ b/apps/site/app/site.json/route.ts @@ -1,9 +1,7 @@ -import { NextResponse } from 'next/server'; - import { siteConfig } from '#site/next.json.mjs'; export const GET = () => - NextResponse.json(siteConfig, { + Response.json(siteConfig, { headers: { 'Cache-Control': 'public, max-age=300, stale-while-revalidate=3600', }, diff --git a/docs/site-config.md b/docs/site-config.md index 689aac7887aff..2cc699ce688b9 100644 --- a/docs/site-config.md +++ b/docs/site-config.md @@ -2,7 +2,7 @@ `apps/site/site.json` is a manually maintained JSON file that controls global site metadata, RSS feeds, and time-sensitive UI elements (banners and badges). -It is imported via `apps/site/next.json.mjs` and exposed as a read-only API endpoint at `/api/site.json`. +It is imported via `apps/site/next.json.mjs` and exposed as a read-only API endpoint at `/site.json`. This endpoint is also consumed externally by the [doc-kit](https://github.com/nodejs/doc-kit) to display dynamic banners inside the API docs, for example security announcements or EOL notices, without requiring a doc-kit release. @@ -117,7 +117,7 @@ A map of page slugs to badge definitions. Badges appear as small promotional lab The full contents of `site.json` are available at: ``` -GET /api/site.json +GET /site.json ``` The response is `application/json` and is statically cached at build time. It refreshes on each deployment.