···7import { getGitHubApiDocsUrl } from '@/util/gitHubUtils';
8import { parseRichTextIntoPlainText } from '@/util/stringUtils';
910-const getPathnameForApiFile = (name: string) =>
11- `api/${name.replace('.md', '.html')}`;
1213// This is the Route Handler for the `GET` method which handles the request
14// for a digest and metadata of all API pages from the Node.js Website
···16export const GET = async () => {
17 const releases = await getReleaseData();
1819- const latestLTSRelease = releases.find(release =>
20 ['Active LTS', 'Maintenance LTS'].includes(release.status)
21- );
2223- 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
···4142 return {
43 filename,
44- pathname: getPathnameForApiFile(name),
45 content: deflatedSource,
46 };
47 }
···7import { getGitHubApiDocsUrl } from '@/util/gitHubUtils';
8import { parseRichTextIntoPlainText } from '@/util/stringUtils';
910+const getPathnameForApiFile = (name: string, version: string) =>
11+ `docs/${version}/api/${name.replace('.md', '.html')}`;
1213// This is the Route Handler for the `GET` method which handles the request
14// for a digest and metadata of all API pages from the Node.js Website
···16export const GET = async () => {
17 const releases = await getReleaseData();
1819+ const { versionWithPrefix } = releases.find(release =>
20 ['Active LTS', 'Maintenance LTS'].includes(release.status)
21+ )!;
2223+ const gitHubApiResponse = await fetch(getGitHubApiDocsUrl(versionWithPrefix));
002425 return gitHubApiResponse.json().then((apiDocsFiles: Array<GitHubApiFile>) => {
26 // maps over each api file and get the download_url, fetch the content and deflates it
···3940 return {
41 filename,
42+ pathname: getPathnameForApiFile(name, versionWithPrefix),
43 content: deflatedSource,
44 };
45 }