frontend/src/routes/api/get-post/+server.ts
2024-09-23 01:20:45 +02:00

19 lines
480 B
TypeScript

import type { RequestHandler } from "./$types";
export const POST: RequestHandler = async ({ request, locals }) => {
const data = await request.json();
const { fastifyURL } = locals;
const response = await fetch(fastifyURL + "/get-post", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
const output = await response.json();
return new Response(JSON.stringify(output));
};