Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reliance on express to work as bare connect middleware #1

Open
shesek opened this issue Mar 20, 2018 · 3 comments
Open

Remove reliance on express to work as bare connect middleware #1

shesek opened this issue Mar 20, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@shesek
Copy link
Collaborator

shesek commented Mar 20, 2018

No description provided.

@shesek shesek added the enhancement New feature or request label Mar 20, 2018
shesek added a commit that referenced this issue Mar 20, 2018
We use a few of express's enhancements to the req/res objects, so this
isn't actually true. Removing this reliance by using the lower-level
nodejs http apis is definitely possible and does not add much complexity.

Refs: #1
@askmike
Copy link

askmike commented Mar 26, 2018

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.

@shesek
Copy link
Collaborator Author

shesek commented Mar 27, 2018

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.

@askmike
Copy link

askmike commented Mar 27, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants