add docker

This commit is contained in:
Fabrice Lamant
2025-12-06 14:55:13 +01:00
parent 3015fc2e78
commit fef4690b0b
24 changed files with 1186 additions and 446 deletions

View File

@ -0,0 +1,24 @@
import { promises as fs } from "fs";
import { NextResponse } from "next/server";
import path from "path";
const DATA_FOLDER = path.resolve("data");
export async function GET(
request: Request,
{ params }: { params: Promise<{ slug?: string[] | undefined }> }
): Promise<NextResponse> {
try {
const { slug } = await params || [];
const filePath = slug ? path.join(DATA_FOLDER, ...slug) : null;
if (!filePath) throw new Error()
const content = await fs.readFile(filePath);
if (!content) throw new Error()
return new NextResponse(content, { status: 200 });
} catch (ex) {
console.log(ex);
return new NextResponse("File not found", { status: 404 });
}
}