How to use installed middlewares in tRPC?

There are a lot of middlewares from npm that I am using like helmet, session and so on. What is the recommended way adding these middlewares in my tRPC app? can you show a simple example?
10 Replies
cje
cje2y ago
Those are specific to Express and don’t work anywhere else without significant customisation If you’re using tRPC inside of Express, you could still use them But most Express middleware doesn’t really make sense in this context
ippo
ippoOP2y ago
wanted to avoid that, to use major parts that create-t3-app already configured for me is there any way to get a tRPC inside Express via create-t3-app?
cje
cje2y ago
no
ippo
ippoOP2y ago
I know the express adapter but if am using it, I have to configure all of that by my own 😦
cje
cje2y ago
the first thing on that page is an example project you can clone
ippo
ippoOP2y ago
sure, but the problem is that then I have to setup next with the server 😦 it looks like we have to use a custom next.js server to get next.js and express with trpc hmm
Panda
Panda2y ago
Maybe make a monorepo structure like t3-turbo?
julius
julius2y ago
If you’re using express you dont need next - use Vite
ippo
ippoOP2y ago
I don't need next? not getting why 🙂 Next.js is awesome and allows you to do many things that I am familiar with.
Want results from more Discord servers?
Add your server