Calling Express `request.send` inside tRPC middleware/procedures
Hello 👋! I've been trying to introduce tRPC to our existing express codebase and I was wondering if it's possible to invoke express
request.send
inside my tRPC middleware or procedures. I want to avoid rewriting our entire auth layer which is unfortunately deeply coupled with the express request/response objects, and instead just call our existing express middleware functions. However I want to make sure doing so isn't going to cause any memory leaks or hanging promises or anything which could silently brick the whole server.
Will the tRPC handler return or exit gracefully if the request is closed? Has anyone had experience with this?
example:
Solution:Jump to solution
@Alex / KATT 🐱: You can pass a fake res-object to await runJWTValidations(req, res)
Example that probably needs some modification:
```ts
const mockRes = {...
1 Reply
Solution
@Alex / KATT 🐱: You can pass a fake res-object to await runJWTValidations(req, res)
Example that probably needs some modification: