parent
4d7cada25c
commit
44e5138b32
3 changed files with 100 additions and 50 deletions
@ -1,36 +0,0 @@ |
||||
--- |
||||
import { getAllBestPractices } from '../lib/best-pratice'; |
||||
import { getAllGuides } from '../lib/guide'; |
||||
import { getRoadmapsByTag } from '../lib/roadmap'; |
||||
import { getAllVideos } from '../lib/video'; |
||||
|
||||
const guides = await getAllGuides(); |
||||
const videos = await getAllVideos(); |
||||
const roadmaps = await getRoadmapsByTag('roadmap'); |
||||
const bestPractices = await getAllBestPractices(); |
||||
|
||||
const formattedData = [ |
||||
...roadmaps.map((roadmap) => ({ |
||||
url: `/${roadmap.id}`, |
||||
title: roadmap.frontmatter.briefTitle, |
||||
group: 'Roadmaps', |
||||
})), |
||||
...bestPractices.map((bestPractice) => ({ |
||||
url: `/${bestPractice.id}`, |
||||
title: bestPractice.frontmatter.briefTitle, |
||||
group: 'Best Practices', |
||||
})), |
||||
...guides.map((guide) => ({ |
||||
url: `/${guide.id}`, |
||||
title: guide.frontmatter.title, |
||||
group: 'Guides', |
||||
})), |
||||
...videos.map((guide) => ({ |
||||
url: `/${guide.id}`, |
||||
title: guide.frontmatter.title, |
||||
group: 'Videos', |
||||
})), |
||||
]; |
||||
--- |
||||
|
||||
{JSON.stringify(formattedData)} |
@ -0,0 +1,36 @@ |
||||
import { getAllBestPractices } from '../lib/best-pratice'; |
||||
import { getAllGuides } from '../lib/guide'; |
||||
import { getRoadmapsByTag } from '../lib/roadmap'; |
||||
import { getAllVideos } from '../lib/video'; |
||||
|
||||
export async function get() { |
||||
const guides = await getAllGuides(); |
||||
const videos = await getAllVideos(); |
||||
const roadmaps = await getRoadmapsByTag('roadmap'); |
||||
const bestPractices = await getAllBestPractices(); |
||||
|
||||
return { |
||||
body: JSON.stringify([ |
||||
...roadmaps.map((roadmap) => ({ |
||||
url: `/${roadmap.id}`, |
||||
title: roadmap.frontmatter.briefTitle, |
||||
group: 'Roadmaps', |
||||
})), |
||||
...bestPractices.map((bestPractice) => ({ |
||||
url: `/best-practices/${bestPractice.id}`, |
||||
title: bestPractice.frontmatter.briefTitle, |
||||
group: 'Best Practices', |
||||
})), |
||||
...guides.map((guide) => ({ |
||||
url: `/${guide.id}`, |
||||
title: guide.frontmatter.title, |
||||
group: 'Guides', |
||||
})), |
||||
...videos.map((guide) => ({ |
||||
url: `/${guide.id}`, |
||||
title: guide.frontmatter.title, |
||||
group: 'Videos', |
||||
})), |
||||
]), |
||||
}; |
||||
} |
Loading…
Reference in new issue