Add new user paths, update user routing to new (WORKING!) user auth version of BE
This commit is contained in:
parent
f5466faa70
commit
d3064fd764
5 changed files with 54 additions and 1 deletions
19
app/api/users/user/username/[username]/route.ts
Normal file
19
app/api/users/user/username/[username]/route.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
const BACKEND_URL = process.env.BACKEND_URL;
|
||||
|
||||
export async function GET(
|
||||
_request: Request,
|
||||
{ params }: { params: Promise<{ username: string }> },
|
||||
) {
|
||||
const { username } = await params;
|
||||
const response = await fetch(`${BACKEND_URL}/users/user/name/${username}`);
|
||||
|
||||
if (!response.ok) {
|
||||
return new Response("Request failed in backend", {
|
||||
status: response.status,
|
||||
});
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
return Response.json(data);
|
||||
}
|
||||
Loading…
Reference in a new issue