"/auth/me" route

This commit is contained in:
Oliver Bryan
2025-12-22 03:27:15 +00:00
parent 835c568552
commit c4c759185b

View 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 });
}