-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Implications of adopting async await with es7 #420
Comments
if you look at https://github.com/thenables/composition, it is done by simply adding a |
My feedback and questions received no reply in #415 :/. I looked at
I guess I'm saying it is non-intuitive that it does indeed call the upstream of the next middleware |
|
Sounds good |
It's looking like koa might adopt
async
await
syntax coming in es7. And its implementation (specifically the way middleware are composed) raises some questions.As the proposal stands, the
async
modifier is set indicating the function returns aPromise
; explicitly or by awaiting one, then returning a value.My question comes from the observation that
next
is not a promise -- how then, can it beawait
-ed?Supposing it were a promise. The nature of it being named
next
implies that the upstream has already occurred which should not be true until afterawait next
.A solution would be to alter the api such that middleware must invoke
next()
which imo gives more control to whoever is implementing the middlewareI could be completely wrong and perhaps not understand the direction koa is going. Is koa going to stick with generators? It would seem the api is designed specifically for them.
The text was updated successfully, but these errors were encountered: