17 lines
483 B
TypeScript
17 lines
483 B
TypeScript
|
|
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 });
|
||
|
|
}
|
||
|
|
|
||
|
|
|