In this video, Emmanuel Henri completes the GET endpoint so you can start pulling your collection from your database. Then he tests the endpoint using Postman and Robot.
- [Instructor] Now that we have an item in our database,…let's create the endpoint that will allow us…to get all of our contacts.…So let's get to it.…So, just as a reminder, this is pretty much going to be…the same thing as what we've done in the last video,…so we're going to create a new function in our controller…to get the contacts, and then pass it to our routes.…Pretty much the same thing,…just some differences in between the code itself.…Let's go and create our second controller.…So again, we're going to export right away that function,…so getContacts.…
We're using again the request response as variables.…Then, what we'll do is call in the collection,…so Contact, and we'll try to find all the contacts…that exist inside of that collection.…This is a function, and we could pass parameters…to that find function but we're not in this case.…Then again, we're doing an error in contact object…so if there's an error, do this.…
If there's data, then pass that data,…and this is where we'll define…what we do with the error or the data.…
- Setting up a project and a server
- Setting up a database and schema
- Creating POST, GET, PUT, and DELETE endpoints
- Serving files
Skill Level Intermediate
1. Setting Up
2. Initial Server Build
3. CRUD Operations
4. Other API Options
Static files serving3m 16s
Next steps1m 1s
- 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.