finds.dev

luin/express-promise

❤️ Middleware for easy rendering of async Query results.

View on GitHub

★ 316JavaScriptMITupdated Nov 2015

// the take

A 2013-era Express middleware that lets you pass promise-returning functions directly to res.json/res.send/res.render, and it resolves them before sending. Solves a real problem that existed before async/await: deeply nested promise chains in route handlers. The target audience no longer exists.

- The core idea is clean — intercepting the response methods and recursively resolving promises in the payload is a neat monkey-patch that required no changes to route handler signatures

- The skipTraverse option shows some awareness of real-world ORM objects where calling toJSON strips methods you might need in templates

- Good test coverage across the main methods (send, json, render) and edge cases like recursive objects

- Dead since 2015 — async/await landed in Node 7.6 (2017) and made this entire pattern obsolete; any new project reaching for this has taken a wrong turn

- Recursive object traversal to find promises is fragile and slow — it will walk your entire response payload looking for thenables, with no depth limit visible in the code

- The implicit 'pass a promise and it resolves' contract is invisible to anyone reading route code; a new developer sees res.json({ user: User.find() }) and has no idea why it works until they find the middleware

- No error handling path shown in the README — if one of three nested promises rejects, it's unclear whether you get a 500, a silent hang, or a partial response

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
316
Forks
19
Language
JavaScript
License
MIT
Last commit
30 Nov 2015

// nearby

If express-promise isn't quite it.

All repos →