geothermie-atlas/app/api/route.ts

29 lines
610 B
TypeScript
Raw Permalink Normal View History

2023-10-19 09:07:33 +00:00
import { NextResponse } from 'next/server';
import { runPythonShell } from './pythonShell';
export async function POST(request: Request) {
const req = await request.json();
let options = {
args: [
req.BT,
req.GT,
req.WLF,
req.BS_HZ_Norm,
req.BS_KL_Norm,
req.BS_HZ,
req.BS_KL,
req.P_HZ,
req.P_KL,
req.boreDepth,
req.heating,
req.points,
req.heating,
],
};
if (options.args.every((arg) => typeof arg !== 'undefined')) {
const results = await runPythonShell(options);
return NextResponse.json(results);
}
}