fastify / fastify-plugin

Plugin helper for Fastify
MIT License
202 stars 43 forks source link

docs(readme): add async await example #123

Closed Fdawgs closed 3 years ago

Fdawgs commented 3 years ago

Closes #117

Checklist

climba03003 commented 3 years ago

Will it be better to add a line about do not use next in async-await ? As we can see, a lot of people is mixing async-await and callback style.

Fdawgs commented 3 years ago

Will it be better to add a line about do not use next in async-await ? As we can see, a lot of people is mixing async-await and callback style.

Have added a link to the MDN page on async functions, and an inline comment noting that callback functions params aren't needed for async functions, in https://github.com/fastify/fastify-plugin/commit/b264fe41fef311e6142d5ba01e5e0aa95a6a4718

Hopefully that should at least give people the hint not to mix callbacks into async functions?