-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
Support for async/await #51
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great stuff sir!
Codecov Report
@@ Coverage Diff @@
## master #51 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 9 10 +1
Lines 142 157 +15
Branches 31 36 +5
=====================================
+ Hits 142 157 +15
Continue to review full report at Codecov.
|
This is now ready for review, please have a look and let me know what you think! CC: @acambas @techfort @peterjcaulfield @padraigobrien @dkatavic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff. Just have some comments about typos and undeleted comment
src/middy.js
Outdated
@@ -79,7 +93,23 @@ const runErrorMiddlewares = (middlewares, instance, done) => { | |||
const nextMiddleware = stack.shift() | |||
|
|||
if (nextMiddleware) { | |||
return nextMiddleware(instance, runNext) | |||
// return nextMiddleware(instance, runNext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment
README.md.hb
Outdated
Middy supports middlewares that return promises instead that directly calling the callback: | ||
|
||
```javascript | ||
const asyncValiator = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asyncValiator
to asyncValidator
README.md.hb
Outdated
Thanks to this behaviour you can define middlewares using `async` functions: | ||
|
||
```javascript | ||
const asyncValiator = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asyncValidator
README.md.hb
Outdated
} | ||
} | ||
|
||
handler.use(asyncValidator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handler.use(asyncValidator)
Thanks, @dkatavic for the thorough review. I made the suggested changes. |
a189c05
to
cb94a34
Compare
Very cool! |
Closes #49 and #50
This will add support for returning promises (instead of invoking the
next
callback) and making possible to useasync
middlewares.More documentation and examples are coming soon.
TODO:
Now ready for review