computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.0 KiB
63 lines
2.0 KiB
import { getAllBestPractices } from '../lib/best-practice'; |
|
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, |
|
description: roadmap.frontmatter.briefDescription, |
|
group: 'Roadmaps', |
|
metadata: { |
|
tags: roadmap.frontmatter.tags, |
|
}, |
|
})), |
|
...bestPractices.map((bestPractice) => ({ |
|
id: bestPractice.id, |
|
url: `/best-practices/${bestPractice.id}`, |
|
title: bestPractice.frontmatter.briefTitle, |
|
description: bestPractice.frontmatter.briefDescription, |
|
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: guide.frontmatter.excludedBySlug |
|
? guide.frontmatter.excludedBySlug |
|
: `/guides/${guide.id}`, |
|
title: guide.frontmatter.title, |
|
description: guide.frontmatter.description, |
|
authorId: guide.frontmatter.authorId, |
|
group: 'Guides', |
|
})), |
|
...videos.map((video) => ({ |
|
id: video.id, |
|
url: `/videos/${video.id}`, |
|
title: video.frontmatter.title, |
|
group: 'Videos', |
|
})), |
|
]), |
|
{ |
|
status: 200, |
|
headers: { |
|
'Content-Type': 'application/json', |
|
}, |
|
}, |
|
); |
|
}
|
|
|