File size: 545 Bytes
7d88b7e
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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));
};