Learn about implementing the endpoints for user CRUD.
- [Narrator] Now let's get the user endpoints…actually working.…We've got the single user endpoint already implemented,…but we need to activate the endpoint…for a list of all the users,…and also implement Delete on the individual user endpoint.…For the userlist endpoint,…we'll just pull the list of documents…in the user collection and return them to the caller.…Just like we did with the task list endpoint,…we can use Find to grab the items in the database.…Find the API v1 users endpoint in the code.…
Notice that I've added an extra configuration section…to the definition for this route.…What this does, is it tells it to…indent and format the JSON so that…it looks nice in the browser when it receives the response.…So in the handler,…we're going to use Find to get a list…of all the users in the database.…So var result equals User.find.…And then we're going to reply back…with the result we receive,…so let's execute result.exec,…and then we'll have callback,…and reply(users).…
All right, that's all we need,…so let's go ahead and go back.…
- Setting up the development environment
- Consuming an API using HTTPie
- Inspecting Mongo data
- Updating the server for MongoDB read functionality
- Setting up application endpoints
- Implementing user endpoints, progress endpoints, and promises
Skill Level Intermediate
Node.js: Build Your First Microservicewith Daniel Khan2h 9m Intermediate
Building a Website with Node.js and Express.jswith Ray Villalobos3h 16m Intermediate
1. API Fundamentals
2. Database Setup
3. Set Up the Fitbit API
4. Create the Progress API
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.