first commit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// API route: GET /api/me. Protected by requireAuth — returns 401 when anonymous,
|
||||
// otherwise the current user hydrated onto ctx by the auth middleware.
|
||||
import { requireAuth, getUser, type Context } from "@wrnexus/core";
|
||||
|
||||
const guard = requireAuth();
|
||||
|
||||
export async function GET(ctx: Context): Promise<Response> {
|
||||
const denied = await guard(ctx, () => new Response(null));
|
||||
if (denied.status === 401) return denied;
|
||||
return Response.json({ ok: true, user: getUser(ctx) });
|
||||
}
|
||||
Reference in New Issue
Block a user