Files
msgapp/src/app/api/posts/[id]/route.ts

17 lines
483 B
TypeScript
Raw Normal View History

2025-10-09 14:18:55 +09:00
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export async function GET(_: Request, context: { params: Promise<{ id: string }> }) {
const { id } = await context.params;
const post = await prisma.post.findUnique({
where: { id },
include: {
board: { select: { id: true, name: true, slug: true } },
},
});
if (!post) return NextResponse.json({ error: "Not found" }, { status: 404 });
return NextResponse.json({ post });
}