simplify auth setup

This commit is contained in:
Aman Varshney
2025-03-18 09:52:50 +05:30
parent 8678ec614a
commit ac2f22073b
26 changed files with 303 additions and 216 deletions

View File

@@ -0,0 +1,18 @@
import type { Context as HonoContext } from "hono";
import { auth } from "./auth";
export type CreateContextOptions = {
hono: HonoContext;
};
export async function createContext({ hono }: CreateContextOptions) {
const session = await auth.api.getSession({
headers: hono.req.raw.headers,
});
return {
session,
};
}
export type Context = Awaited<ReturnType<typeof createContext>>;