Initial 智念AIGC platform
This commit is contained in:
21
app/api/settings/route.ts
Normal file
21
app/api/settings/route.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { getApiSettings, saveApiSettings } from "@/lib/server/app-settings";
|
||||
import { jsonError, jsonOk, readJsonBody } from "@/lib/server/api";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
return jsonOk(await getApiSettings());
|
||||
} catch (error) {
|
||||
return jsonError(error, 500);
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
const body = await readJsonBody<{ values?: Record<string, unknown> }>(request);
|
||||
return jsonOk(await saveApiSettings(body.values || {}));
|
||||
} catch (error) {
|
||||
return jsonError(error, 500);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user