Backend overhaul to integrate MongoDB Atlas database into the app
Overview:
Created MongoDB Atlas Database under my account.
Updated backend so .env file now holds MongoDB connection key along with Spotify keys
All Spotify API calls are made by our own code; no longer the library. All of these calls are on the backend
When a user logs in, the app checks if their info is in the database and when their info was last updated. If their data is not in the database or if their data was last updated over a day ago, the API calls are made to get all of their TopNData to store in the database and use to display the app.
All of the backend uses ES standards instead of CommonJS (import instead of .require(), export instead of module.exports, etc)
Removed use of deprecated libraries like "request"--now using axios.
Benefits and future improvements
Now, API calls can be made on a daily basis only rather than EVERY TIME a user logs in. This heavily decreases the chances of rate limiting. For n=50 in TopNData, one user takes up approximately 2-3MB of data in MongoDB. The free tier allows us 500MB of storage. The n can be modified in backend.js.
This also means that we can display stats of users that are not logged in; my next feature will be a sharing link to a profile. The link will show the user's stats to whoever has the link, which is only possible when we have this database integration.
Backend overhaul to integrate MongoDB Atlas database into the app
Overview:
Benefits and future improvements