Clean up code

This commit is contained in:
2025-10-09 18:46:14 +02:00
parent a45e379dd1
commit fd186a1c3b

View File

@@ -1,12 +1,11 @@
import { configPath, configTemplate } from '@/const/api'; import { configPath, configTemplate } from '@/const/api';
import fs from 'fs/promises'; import fs from 'fs/promises';
import { NextRequest, NextResponse } from 'next/server'; import { NextResponse } from 'next/server';
export async function GET(request: NextRequest) { export async function GET() {
try { try {
const fileBuffer = await fs.readFile(configPath, 'utf8'); const fileBuffer = await fs.readFile(configPath, 'utf8');
const config = JSON.parse(fileBuffer); const config = JSON.parse(fileBuffer);
console.log(config);
return NextResponse.json(config, { status: 200 }); return NextResponse.json(config, { status: 200 });
} catch { } catch {
await fs.writeFile(configPath, JSON.stringify(configTemplate, null, 2)); await fs.writeFile(configPath, JSON.stringify(configTemplate, null, 2));