课程: Databases for Node.js Developers (2021)

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Add order management

Add order management

- [Instructor] All that is left to do now to finalize the order management is to use the order service in our routes. So for that, I first go into server routes, basket index.js, so this is the basket page, and there we already bring in the order service and instantiated in that line, and if I scroll down all the way to see that here we have the route for actually buying the contents of this basket. So let's remove the return statement and the comments here and also remove the next argument and first in line 69, I'm checking if there is a current user, if not, something is wrong, the user should not be on this page, so I redirect and provide a warning. Otherwise I will get user at the end, user from the current user and then I instantiate the basket for this given user and get all the basket items in line 82. If there are no basket items, I throw an error, because if that happens, I should not be on this page…

内容