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.
28 lines
653 B
28 lines
653 B
2 years ago
|
import type { APIRoute } from 'astro';
|
||
|
|
||
|
export async function getStaticPaths() {
|
||
|
const roadmapJsons = await import.meta.glob('/src/data/roadmaps/**/*.json', {
|
||
|
eager: true,
|
||
|
});
|
||
|
|
||
|
return Object.keys(roadmapJsons).map((filePath) => {
|
||
|
const roadmapId = filePath.split('/').pop()?.replace('.json', '');
|
||
|
const roadmapJson = roadmapJsons[filePath] as Record<string, any>;
|
||
|
|
||
|
return {
|
||
|
params: {
|
||
|
roadmapId,
|
||
|
},
|
||
|
props: {
|
||
|
roadmapJson: roadmapJson,
|
||
|
},
|
||
|
};
|
||
|
});
|
||
|
}
|
||
|
|
||
|
export const get: APIRoute = async function ({ params, request, props }) {
|
||
|
return {
|
||
|
body: JSON.stringify(props.roadmapJson),
|
||
|
};
|
||
|
};
|