21 lines
791 B
TypeScript
21 lines
791 B
TypeScript
import { NextRequest } from 'next/server';
|
|
|
|
const BACKEND_BASE = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://127.0.0.1:8000/api';
|
|
|
|
export async function GET() {
|
|
const resp = await fetch(`${BACKEND_BASE}/config`);
|
|
const text = await resp.text();
|
|
return new Response(text, { status: resp.status, headers: { 'Content-Type': resp.headers.get('Content-Type') || 'application/json' } });
|
|
}
|
|
|
|
export async function PUT(req: NextRequest) {
|
|
const body = await req.text();
|
|
const resp = await fetch(`${BACKEND_BASE}/config`, {
|
|
method: 'PUT',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body,
|
|
});
|
|
const text = await resp.text();
|
|
return new Response(text, { status: resp.status, headers: { 'Content-Type': resp.headers.get('Content-Type') || 'application/json' } });
|
|
}
|