Urara-Blog/src/routes/posts.json/+server.ts
2022-09-03 13:04:22 +08:00

10 lines
305 B
TypeScript

import type { RequestHandler } from './$types'
import { genPosts } from '$lib/utils/posts'
export const prerender = true
export const GET: RequestHandler = async () =>
new Response(JSON.stringify(genPosts(), null, 2), {
headers: {
'content-type': 'application/json; charset=utf-8'
}
})