Self-contained Dockerized build for end users. Run via docker compose; see README.md for setup. Source-only, no sample data or build artifacts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
20 lines
623 B
JavaScript
20 lines
623 B
JavaScript
import { NextResponse } from "next/server";
|
|
import { listAssignments, createAssignment } from "@/lib/store";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET() {
|
|
return NextResponse.json({ assignments: listAssignments() });
|
|
}
|
|
|
|
export async function POST(request) {
|
|
try {
|
|
const body = await request.json();
|
|
if (!body || typeof body !== "object") throw new Error("Missing assignment body.");
|
|
const record = createAssignment(body);
|
|
return NextResponse.json(record, { status: 201 });
|
|
} catch (e) {
|
|
return NextResponse.json({ error: String(e.message || e) }, { status: 400 });
|
|
}
|
|
}
|