15 lines
315 B
JavaScript
15 lines
315 B
JavaScript
import { getAllPosts } from '@/lib/posts';
|
|
|
|
export async function GET() {
|
|
const posts = (await getAllPosts()).map((post) => ({
|
|
title: post.title,
|
|
href: post.href,
|
|
}));
|
|
|
|
return new Response(JSON.stringify(posts), {
|
|
headers: {
|
|
'content-type': 'application/json; charset=utf-8',
|
|
},
|
|
});
|
|
}
|