mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
"/auth/me" route
This commit is contained in:
11
packages/backend/src/routes/auth/me.ts
Normal file
11
packages/backend/src/routes/auth/me.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import type { AuthedRequest } from "../../auth/middleware";
|
||||||
|
import { getUserById } from "../../db/queries";
|
||||||
|
|
||||||
|
export default async function me(req: AuthedRequest) {
|
||||||
|
const user = await getUserById(req.userId);
|
||||||
|
if (!user) {
|
||||||
|
return new Response("user not found", { status: 404 });
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response.json({ id: user.id, name: user.name, username: user.username });
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user