frontend/src/routes/blog/+page.server.ts
2025-02-13 17:28:51 +01:00

21 lines
410 B
TypeScript

export const load = async ({locals}) => {
const { pb } = locals;
const getAllBlogPost = async () => {
// make the POST request to the endpoint
const output = await pb.collection("articles").getFullList({
sort: "-created",
});
return output;
};
// Make sure to return a promise
return {
getAllBlogPost: await getAllBlogPost(),
};
};