oRPC Middleware
Installation
SKILL.md
Middleware in oRPC
Middleware is a powerful feature in oRPC that enables reusable and extensible procedures.
Overview
const authMiddleware = os
.$context<{ something?: string }>() // define dependent-context
.middleware(async ({ context, next }) => {
// before
const result = await next({
context: { user: { id: 1, name: 'John' } }
})
// after
return result
})