-
Notifications
You must be signed in to change notification settings - Fork 22.4k
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
What is asyncHandler? #26239
Comments
Hi @danbraun The handler is set up when you set your routes in an earlier part of the tutorial: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/routes#bookinstance_controller The purpose of the handler is covered in the earlier section https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/routes#handling_exceptions_in_route_functions. Note you should read the section before this too - they "tell a story in order". The handler is then described again in the first tutorial for setting up a page: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/Displaying_data/Home_page#controller You may have missed this because you did the routes and earlier parts of the tutorial last week and then took a few days break. The documentation was just updated late last week so you would have missed this information. If so, many apologies. I'm, going to close as "not a defect", but if I'm missing something feel free to reopen. |
Thanks for taking the time to explain that. It is very helpful.
… On Apr 16, 2023, at 7:01 PM, Hamish Willee ***@***.***> wrote:
Hi @danbraun <https://github.com/danbraun>
The handler is set up when you set your routes in an earlier part of the tutorial: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/routes#bookinstance_controller
The purpose of the handler is covered in the earlier section https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/routes#handling_exceptions_in_route_functions. Note you should read the section before this too - they "tell a story in order".
The handler is then described again in the first tutorial for setting up a page: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/Displaying_data/Home_page#controller
I haven't duplicated this explanation in every tutorial, because it would be boring, and should not be necessary.
You may have missed this because you did the routes and earlier parts of the tutorial last week and then took a few days break. The documentation was just updated late last week so you would have missed this information. If so, many apologies.
I'm, going to close as "not a defect", but if I'm missing something feel free to reopen.
—
Reply to this email directly, view it on GitHub <#26239 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABT5TAFKO4GEDCRSNY4MH3LXBSB7LANCNFSM6AAAAAAXADKTJI>.
You are receiving this because you were mentioned.
|
Great. Sorry you got caught in the docs update. I had to add this because mongoose no longer supports a callback API - only promises. The tutorial is much better for moving to await/async though, because you no longer have to include boilerplate for the error handling in every function. Good luck with the tutorial, and thanks for taking the time to raise issues. |
MDN URL
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/Displaying_data/BookInstance_list_page
What specific section or headline is this issue about?
bookinstanceController code
What information was incorrect, unhelpful, or incomplete?
asyncHandler does not exist.
What did you expect to see?
The method shouldn't be wrapped in this function which is not defined.
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/learn/server-side/express_nodejs/displaying_data/bookinstance_list_page
The text was updated successfully, but these errors were encountered: