paypercall icon indicating copy to clipboard operation
paypercall copied to clipboard

Remove reliance on express to work as bare connect middleware

Open shesek opened this issue 7 years ago • 3 comments

shesek avatar Mar 20 '18 07:03 shesek

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.

askmike avatar Mar 26 '18 10:03 askmike

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.

shesek avatar Mar 27 '18 11:03 shesek

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.

askmike avatar Mar 27 '18 11:03 askmike