···1import { deflateSync } from 'node:zlib';
203import { VERCEL_REVALIDATE } from '@/next.constants.mjs';
4import { defaultLocale } from '@/next.locales.mjs';
5import type { GitHubApiFile } from '@/types';
···13// for a digest and metadata of all API pages from the Node.js Website
14// @see https://nextjs.org/docs/app/building-your-application/routing/router-handlers
15export const GET = async () => {
16- const gitHubApiResponse = await fetch(getGitHubApiDocsUrl('main'));
000000001718 return gitHubApiResponse.json().then((apiDocsFiles: Array<GitHubApiFile>) => {
19 // maps over each api file and get the download_url, fetch the content and deflates it
···1import { deflateSync } from 'node:zlib';
23+import getReleaseData from '@/next-data/releaseData';
4import { VERCEL_REVALIDATE } from '@/next.constants.mjs';
5import { defaultLocale } from '@/next.locales.mjs';
6import type { GitHubApiFile } from '@/types';
···14// for a digest and metadata of all API pages from the Node.js Website
15// @see https://nextjs.org/docs/app/building-your-application/routing/router-handlers
16export const GET = async () => {
17+ const releases = await getReleaseData();
18+19+ const latestLTSRelease = releases.find(release =>
20+ ['Active LTS', 'Maintenance LTS'].includes(release.status)
21+ );
22+23+ const gitHubApiResponse = await fetch(
24+ getGitHubApiDocsUrl(latestLTSRelease!.versionWithPrefix)
25+ );
2627 return gitHubApiResponse.json().then((apiDocsFiles: Array<GitHubApiFile>) => {
28 // maps over each api file and get the download_url, fetch the content and deflates it