frontend/src/routes/etf/new-launches/+page.server.ts
2024-09-20 15:41:59 +02:00

23 lines
536 B
TypeScript

export const load = async ({ locals }) => {
const getETFNewLaunches = async () => {
const { apiKey, apiURL } = locals;
// make the POST request to the endpoint
const response = await fetch(apiURL + "/etf-new-launches", {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-KEY": apiKey,
},
});
const output = await response.json();
return output;
};
// Make sure to return a promise
return {
getETFNewLaunches: await getETFNewLaunches(),
};
};