Open shesek opened 6 years ago
I think that a (req, res, next)
function feels more natural in the nodejs ecosystem as the low-level underlying implementation, with alternative implementations for promises, koa, etc built as a wrapper on top. Do you see an advantage to making the underling implementation promise based?
Note that paypercall is built on top of lightning-charge-client-js, which itself exposes a promise-based API that can be used directly for projects that needs more flexibility than what paypercall provides.
Note that paypercall is built on top of lightning-charge-client-js
This is what I meant. Apologies, I couldn't find this the first time I looked through the code!
Do you see an advantage to making the underling implementation promise based?
I agree that connect is a big standard in the nodejs ecosystem, it is probably safer to create a solid basis around a connect plugin over a barebone implementation (that would just wrap around lightning-charge-client-js anyway).
From a Koa perspective: there are ways to koafy a connect plugin on the fly, such as https://github.com/vkurchatkin/koa-connect but they are not as clean. Since promises and async/await is available natively I consider them to be cleaner. Though connect is so much bigger that it doesn't make sense.
I would vote for an even smaller promise/async based API so that you can just add a few wrappers, this way supporting Koa for example is also easy. Even allows for easy integration with non HTTP based APIs.