修复随机文章

This commit is contained in:
2026-06-18 20:36:03 +08:00 Unverified
parent 41854a128d
commit 7dc7cd9e73
2 changed files with 35 additions and 12 deletions
+14
View File
@@ -0,0 +1,14 @@
import { getAllPosts } from '@/lib/posts';
export function GET() {
const posts = getAllPosts().map((post) => ({
title: post.title,
href: post.href,
}));
return new Response(JSON.stringify(posts), {
headers: {
'content-type': 'application/json; charset=utf-8',
},
});
}