mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
19 lines
401 B
TypeScript
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>>;
|