29 lines
610 B
TypeScript
29 lines
610 B
TypeScript
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);
|
|
}
|
|
}
|