fix: add lesson 6

This commit is contained in:
2026-03-17 17:24:10 +01:00
parent 9ffdecf2c4
commit 8df4087cfd
91 changed files with 10392 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { NextResponse } from "next/server";
import { getPollById } from "@/lib/data";
import type { Poll } from "@/types";
interface RouteParams {
params: Promise<{ id: string }>;
}
// STAP 3: GET /api/polls/[id] — enkele poll ophalen
// (Dit bestand is COMPLEET van Les 5. Dit is stap 3 van Les 5.)
export async function GET(
request: Request,
{ params }: RouteParams
): Promise<NextResponse> {
const { id } = await params;
const poll = getPollById(id);
if (!poll) {
return NextResponse.json(
{ error: "Poll niet gevonden" },
{ status: 404 }
);
}
return NextResponse.json<Poll>(poll);
}