create-better-t-stack
Version:
A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations
19 lines (14 loc) • 416 B
text/typescript
import type { Context as ElysiaContext } from "elysia";
import { auth } from "./auth";
export type CreateContextOptions = {
context: ElysiaContext;
};
export async function createContext({ context }: CreateContextOptions) {
const session = await auth.api.getSession({
headers: context.request.headers,
});
return {
session,
};
}
export type Context = Awaited<ReturnType<typeof createContext>>;