MCPcopy Create free account
hub / github.com/api-platform/website / getAllEvents

Function getAllEvents

pwa/api/events.ts:16–40  ·  view source on GitHub ↗
(withContent?: boolean)

Source from the content-addressed store, hash-verified

14}
15
16export async function getAllEvents(withContent?: boolean) {
17 const directory = "data/events";
18
19 const files = (await readdir(path.join(process.cwd(), directory))).filter(
20 (file) => path.extname(file) === ".mdx"
21 );
22
23 const events = await Promise.all(
24 files.map(async (file) => {
25 const fullPath = path.join(process.cwd(), directory, file);
26 const [fileContents, resultMdx] = await Promise.all([
27 readFile(fullPath, "utf8"),
28 import(`data/events/${file}`),
29 ]);
30
31 return {
32 ...resultMdx.meta,
33 title: extractTitleFromMarkdown(fileContents),
34 slug: path.parse(file).name,
35 Mdx: withContent && resultMdx.default,
36 };
37 })
38 );
39 return events.sort(sortByEventStartDate);
40}
41
42async function getSpeakerLink(login: string) {
43 const contributors = getAllContributors();

Callers 4

getAllStandardRoutesFunction · 0.90
PageFunction · 0.90
generateStaticParamsFunction · 0.90
PageFunction · 0.90

Calls 2

extractTitleFromMarkdownFunction · 0.90
readFileFunction · 0.85

Tested by

no test coverage detected