From eaa777da79b076533b4aa07503f4198c73d1ef93 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sat, 13 Apr 2024 19:01:49 -0400 Subject: [PATCH] Update route.ts --- app/api/posts/[slug]/route.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/api/posts/[slug]/route.ts b/app/api/posts/[slug]/route.ts index 75d2e33..d4329f7 100644 --- a/app/api/posts/[slug]/route.ts +++ b/app/api/posts/[slug]/route.ts @@ -6,4 +6,10 @@ export async function GET(request: NextRequest, {params}: { params: { slug: stri const slug = params.slug; const post = getPostBySlug(slug); return NextResponse.json(post); -} \ No newline at end of file +} + + +export async function generateStaticParams() { + const slugs = await getAllSlugs(); + return slugs.map((slug) => ({ slug })); +}