Skip to content

add promise example #17

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

Closed
wants to merge 2 commits into from
Closed

add promise example #17

wants to merge 2 commits into from

Conversation

talves
Copy link

@talves talves commented Dec 6, 2018

With the new Node.js 8.10 runtime, there are new handler types that can be declared with the “async” keyword or can return a promise directly.

For completion, I propose to add the example to return a promise

Please make changes as you see fit. 😀

@talves
Copy link
Author

talves commented Dec 6, 2018

I was hoping this project had deploy previews turned on. (hint, hint!)

@swyxio
Copy link
Contributor

swyxio commented Dec 6, 2018

just turned it on.. hopefully that works

as far as this one is concerned - i dont want to encourage this because using async/await already implies returning a promise. you're using both here.

what if we took out the async keyword? thats possible. i believe thats what your original source is trying to say. however i still wouldnt want to encourage it. basically if you can use async/await then theres no scenario in which you prefer returning a Promise. you can still do it, of course.

@talves
Copy link
Author

talves commented Dec 6, 2018

Yeah, I understand. I don't think you can remove the async without returning a promise directly without using the callback. That is why I thought for completeness we should add this example, so people understand, but it may be confusing. They are the same thing really, just two acceptable ways to create an async function in lambda.

@netlify
Copy link

netlify bot commented Dec 6, 2018

Deploy success!

Built with commit 0abb893

https://deploy-preview-17--festive-nightingale-47f180.netlify.com

@swyxio
Copy link
Contributor

swyxio commented Dec 6, 2018

alrighty we agree. if its alright with you im just gonna close without merging. thanks a lot for thinking it thru with me

@swyxio swyxio closed this Dec 6, 2018
@talves
Copy link
Author

talves commented Dec 6, 2018 via email

@talves talves deleted the promise-chucky branch June 4, 2019 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants