server/api/cakes/[id].get.ts
Route Parameter
Example
Read a file-based route parameter from the API context.
export default async (_data: unknown, context: ApiContext) => {
const cake = await db.cake.findUnique({
where: { id: context.params.id },
});
if (!cake) return new Response("Cake not found.", { status: 404 });
return { cake };
};