|
|
|
import { getAllBestPractices } from '../lib/best-pratice';
|
|
|
|
import { getAllGuides } from '../lib/guide';
|
|
|
|
import { getRoadmapsByTag } from '../lib/roadmap';
|
|
|
|
import { getAllVideos } from '../lib/video';
|
|
|
|
import {getAllQuestionGroups} from "../lib/question-group";
|
|
|
|
|
|
|
|
export async function GET() {
|
|
|
|
const guides = await getAllGuides();
|
|
|
|
const videos = await getAllVideos();
|
|
|
|
const questionGroups = await getAllQuestionGroups();
|
|
|
|
const roadmaps = await getRoadmapsByTag('roadmap');
|
|
|
|
const bestPractices = await getAllBestPractices();
|
|
|
|
|
|
|
|
return new Response(
|
|
|
|
JSON.stringify([
|
|
|
|
...roadmaps.map((roadmap) => ({
|
|
|
|
id: roadmap.id,
|
|
|
|
url: `/${roadmap.id}`,
|
|
|
|
title: roadmap.frontmatter.briefTitle,
|
|
|
|
group: 'Roadmaps',
|
|
|
|
metadata: {
|
|
|
|
tags: roadmap.frontmatter.tags,
|
|
|
|
},
|
|
|
|
})),
|
|
|
|
...bestPractices.map((bestPractice) => ({
|
|
|
|
id: bestPractice.id,
|
|
|
|
url: `/best-practices/${bestPractice.id}`,
|
|
|
|
title: bestPractice.frontmatter.briefTitle,
|
|
|
|
group: 'Best Practices',
|
|
|
|
})),
|
|
|
|
...questionGroups.map((questionGroup) => ({
|
|
|
|
id: questionGroup.id,
|
|
|
|
url: `/questions/${questionGroup.id}`,
|
|
|
|
title: questionGroup.frontmatter.briefTitle,
|
|
|
|
group: 'Questions',
|
|
|
|
})),
|
|
|
|
...guides.map((guide) => ({
|
|
|
|
id: guide.id,
|
|
|
|
url: `/guides/${guide.id}`,
|
|
|
|
title: guide.frontmatter.title,
|
|
|
|
group: 'Guides',
|
|
|
|
})),
|
|
|
|
...videos.map((guide) => ({
|
|
|
|
id: guide.id,
|
|
|
|
url: `/videos/${guide.id}`,
|
|
|
|
title: guide.frontmatter.title,
|
|
|
|
group: 'Videos',
|
|
|
|
})),
|
|
|
|
]),
|
|
|
|
{
|
|
|
|
status: 200,
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|