tRPCttRPC
Powered by
HuzefH
tRPC•4y ago•
7 replies
Huzef

Request context inside middleware?

Hi,

Is it possible to get the request context inside a middleware somehow?
I'm trying to migrate a Express Based API

const t = initTRPC.context<Context>().create();

const useAuthentication =  t.middleware(({ next, ctx }) => {
   const token = ctx.req.headers['authorization']
})
const t = initTRPC.context<Context>().create();

const useAuthentication =  t.middleware(({ next, ctx }) => {
   const token = ctx.req.headers['authorization']
})
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Calling Express `request.send` inside tRPC middleware/procedures
skylerdjSskylerdj / ❓-help
16mo ago
Validating input inside middleware declaration
BlitzBBlitz / ❓-help
3y ago
Request context from getServerSideProps
nehalistNnehalist / ❓-help
4y ago