app.use('/trpc', async (req, res, next) => { const client = await getClient() req.client = client await createExpressMiddleware({ router: appRouter, createContext })(req, res, next) if (req.client) { await req.client.release() }})
/trpc
app.use(async (req, res, next) => { const client = await getClient() req.client = client next()})app.use('/trpc', async (req, res, next) => { await createExpressMiddleware({ router: appRouter, createContext, })(req, res, next) next()})app.use(async (req, res) => { if (req.client) { await req.client.release() }})