Files
Neon-Desk/app/api/tasks/[taskId]/route.ts

18 lines
410 B
TypeScript

import { jsonError } from '@/lib/server/http';
import { getTaskById } from '@/lib/server/tasks';
type Context = {
params: Promise<{ taskId: string }>;
};
export async function GET(_request: Request, context: Context) {
const { taskId } = await context.params;
const task = await getTaskById(taskId);
if (!task) {
return jsonError('Task not found', 404);
}
return Response.json({ task });
}