···11import { deflateSync } from 'node:zlib';
2233+import getReleaseData from '@/next-data/releaseData';
34import { VERCEL_REVALIDATE } from '@/next.constants.mjs';
45import { defaultLocale } from '@/next.locales.mjs';
56import type { GitHubApiFile } from '@/types';
···1314// for a digest and metadata of all API pages from the Node.js Website
1415// @see https://nextjs.org/docs/app/building-your-application/routing/router-handlers
1516export const GET = async () => {
1616- const gitHubApiResponse = await fetch(getGitHubApiDocsUrl('main'));
1717+ const releases = await getReleaseData();
1818+1919+ const latestLTSRelease = releases.find(release =>
2020+ ['Active LTS', 'Maintenance LTS'].includes(release.status)
2121+ );
2222+2323+ const gitHubApiResponse = await fetch(
2424+ getGitHubApiDocsUrl(latestLTSRelease!.versionWithPrefix)
2525+ );
17261827 return gitHubApiResponse.json().then((apiDocsFiles: Array<GitHubApiFile>) => {
1928 // maps over each api file and get the download_url, fetch the content and deflates it