t
tRPC
t
tRPC
Modifying context in a procedure.
Original message was deleted
tRPC
Join
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,111
Members
View on Discord
A
Ahmed Elsakaan
•
3/14/23, 5:33 AM
you can do so in a middleware
A
Ahmed Elsakaan
•
3/14/23, 5:35 AM
see here how the enforceUserIsAuthed is done as an example
https://github.com/t3-oss/create-t3-app/blob/next/cli/template/extras/src/server/api/trpc/with-auth-prisma.ts
GitHub
create-t3-app/with-auth-prisma.ts at next · t3-oss/create-t3-app
The best way to start a full
-stack
, typesafe Next
.js app
- create
-t3
-app
/with
-auth
-prisma
.ts at next
· t3
-oss
/create
-t3
-app
N
Nick
•
3/14/23, 7:47 AM
You
’ll want a singleton for that
N
Nick
•
3/14/23, 7:47 AM
But it
’s possibly a bad idea to make your api stateful
N
Nick
•
3/14/23, 7:49 AM
Caching can be okay
N
Nick
•
3/14/23, 7:51 AM
But if you scale out then it
’s best to use a service which is outside your api but inside your control