frontend/src/routes/api/indicator-data/+server.ts
2024-10-11 15:12:38 +02:00

25 lines
619 B
TypeScript

import type { RequestHandler } from "./$types";
export const POST: RequestHandler = async ({ request, locals }) => {
const data = await request.json();
const { apiURL, apiKey } = locals;
const postData = {
ruleOfList: data?.ruleOfList,
tickerList: data?.tickerList,
};
const response = await fetch(apiURL + "/indicator-data", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": apiKey,
},
body: JSON.stringify(postData),
});
const output = await response?.json();
return new Response(JSON.stringify(output));
};