blog/src/routes/+page.ts
2023-04-28 15:24:55 +02:00

8 lines
188 B
TypeScript

import type { Post } from '$lib/types'
export async function load({ fetch }) {
const response = await fetch('api/posts')
const posts: Post[] = await response.json()
return { posts }
}