Learn how to retrieve user activity data.
- [Instructor] So far we've got the user logging in…and we grab a new token every time.…Let's store those tokens in Mongo…and only refresh them when needed.…The goal here will be to make it possible…to pull the user's profile using the token information…in the database.…So first, we need to update the top of the script to store…the user's data in the database.…We'll only be storing the user ID and tokens from Fitbit.…The rest of the items we'll go ahead…and grab from the Fitbit API when a request is made.…Let's put the Mongoose information back at the top here.…
We'll just copy and paste from previous versions,…but we need to add a user schema,…so var, user schema is mongoose schema…and we'll have a user ID…which is a string.…We're going to have an access token,…also a string,…and then a refresh token,…also a string.…We've got the schema all set up now,…so what we're going to do is create an interface…to the items in the database.…
So, var user…is mongoose model,…user,…user schema.…Alright, so we're all set up.…You might be concerned about storing…
- 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?
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.