1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-30 13:41:54 +02:00
blog/src/pages/api/posts.ts

10 lines
289 B
TypeScript

import type { APIRoute } from 'astro'
import { getAllPostsForSearch } from '@lib/astro'
export const GET: APIRoute = async () => {
const allPosts = await getAllPostsForSearch()
return new Response(JSON.stringify(allPosts), {
headers: { 'content-type': 'application/json' }
})
}