Join Shaun Wassell for an in-depth discussion in this video Rewriting the comments endpoint, part of React: Creating and Hosting a Full-Stack Site.
we want to use and then we have to call client.close … and this function's going to take care of all … of the setup and tear down for us, … We'll call this function operations, … Let's just copy and paste it from our get articles endpoint. … We're getting our database, and then we're performing … our operations and finally we're calling client.close … Now that we're written this withDB function to take care … let's refactor our two existing endpoints … and then we'll move on to the comments section. … So we'll start off with our get article info endpoint, … and we're going to remove everything related to the database. … So we'll remove the catch block and the client.close, … we have to put async here as well, … and that in turn means that we have to put the await keyword … So it'll look like async db, … Now that we're getting the hang of rewriting our code … because they no longer work. … to the existing comments which we get … And finally we want to send this updated articleInfo … Now let's go back and test it in Postman …
- Creating the app component
- Using React-Router links
- Setting up an Express server
- Route parameters in Express
- Adding the comments functionality
- Installing and adding MongoDB to your project
- Rewriting the endpoints
- Adding React hooks
- Adding buttons and forms
- Pushing code to GitHub
- Running a full-stack app on AWS
Skill Level Intermediate
1. Creating a React Front End
2. Creating a Node Back End
3. Setting Up MongoDB
4. Connecting the Front and Back Ends
5. Hosting the Site
Next steps1m 17s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.