Files
create-better-t-stack/apps/cli/template/with-prisma-sqlite/packages/server/src/lib/context.ts
2025-03-18 09:52:59 +05:30

19 lines
401 B
TypeScript

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>>;