reymon359
reymon359
Explore posts from servers
TtRPC
Created by reymon359 on 3/12/2024 in #❓-help
Why do we pass the database client in the context
Hey there 👋 In the examples and in T3app we pass the db client in the trpc context
export async function createContextInner(opts?: CreateInnerContextOptions) {
return {
prisma,
session: opts.session,
};
}
export async function createContextInner(opts?: CreateInnerContextOptions) {
return {
prisma,
session: opts.session,
};
}
then, to make requests to the db we use it from the context such as ctx.prisma.whatever.create() I would like to understand why do we do so. Why no just import the client and use it such as import { prisma } from "~/server/db"; and then in the router use prisma.whatever.create() without the ctx. Why is it used from the context? What are the benefits? does it really matter?
2 replies
TTCTheo's Typesafe Cult
Created by reymon359 on 2/1/2023 in #questions
Is there any guide or tips for migrating a Blitzjs app?
Hey there 👋 I have a PWA Blitz.js app that would like to migrate to the t3 stack. I would like to know if someone else has done it before and if they have some tips, here are some random questions that pop my mind: Where should I start? Can I keep my Prisma schema? How different is the auth and session management?
1 replies