Spaces:
Running
Running
export const POST = async ({ request }) => { | |
const endpoint = request.headers.get("endpoint"); | |
const row = await request.json(); | |
const response = await fetch(`https://dylanebert-research-tracker-backend.hf.space/${endpoint}`, { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
Authorization: "Bearer " + import.meta.env.VITE_HF_TOKEN, | |
}, | |
body: JSON.stringify(row), | |
}); | |
const data = await response.json(); | |
return new Response(JSON.stringify(data)); | |
}; | |