Dagemark-Webapp/app/api/users/user/route.ts

21 lines
480 B
TypeScript

const BACKEND_URL = process.env.BACKEND_URL;
export async function GET(request: Request) {
const authorization = request.headers.get("authorization");
const response = await fetch(`${BACKEND_URL}/users/user`, {
headers: {
Authorization: authorization ?? "",
},
});
if (!response.ok) {
return new Response("Request failed in backend", {
status: response.status,
});
}
const data = await response.json();
return Response.json(data);
}