21 lines
482 B
TypeScript
21 lines
482 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { getRedis } from "@/lib/redis";
|
|
|
|
export async function GET(
|
|
_request: Request,
|
|
{ params }: { params: Promise<{ id: string }> }
|
|
) {
|
|
const { id } = await params;
|
|
const redis = getRedis();
|
|
|
|
const result = await redis.get(`codeboard:result:${id}`);
|
|
if (!result) {
|
|
return NextResponse.json(
|
|
{ error: "Documentation not found" },
|
|
{ status: 404 }
|
|
);
|
|
}
|
|
|
|
return NextResponse.json(JSON.parse(result));
|
|
}
|