25 lines
619 B
TypeScript
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));
|
|
};
|