17 lines
516 B
TypeScript
17 lines
516 B
TypeScript
import {NextResponse} from "next/server";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
|
|
export async function GET() {
|
|
const configPath = process.env.CONFIG_PATH || "./config.json";
|
|
const absolutePath = path.resolve(configPath);
|
|
|
|
if (!fs.existsSync(absolutePath)) {
|
|
return NextResponse.json({error: "Config file not found"}, {status: 404});
|
|
}
|
|
|
|
const fileContent = fs.readFileSync(absolutePath, "utf-8");
|
|
const config = JSON.parse(fileContent);
|
|
|
|
return NextResponse.json(config);
|
|
} |