fix oRPC context, route for express

This commit is contained in:
Aman Varshney
2025-04-17 22:13:00 +05:30
parent b8c16d0610
commit 2a51f85989
4 changed files with 19 additions and 7 deletions

View File

@@ -70,13 +70,12 @@ export async function createContext({ context }: CreateContextOptions) {
}
{{else if (eq backend 'express')}}
import type { CreateExpressContextOptions } from "@trpc/server/adapters/express";
{{#if auth}}
import { fromNodeHeaders } from "better-auth/node";
import { auth } from "./auth";
{{/if}}
export async function createContext(opts: CreateExpressContextOptions) {
export async function createContext(opts: any) {
{{#if auth}}
const session = await auth.api.getSession({
headers: fromNodeHeaders(opts.req.headers),