A song recommendation system using nodejs and spotify api based on the users spotify data
- Imports the required packages/modules: Express, Axios, SpotifyWebApi, Cors, SwaggerJsDoc, and SwaggerUi.
- Sets up Swagger documentation for the API endpoints, using the swagger-jsdoc and swagger-ui-express packages.
- Initializes the SpotifyWebApi with the necessary client ID, client secret, and redirect URI.
- Calculates average values for certain audio features of the user's top tracks, and then uses those values to generate a set of recommended tracks.
- Defines two helper functions: 'calculateAverage' and 'calculatePopularGenres'. 'calculateAverage' computes the average value of a given feature for a set of tracks, while 'calculatePopularGenres' identifies the most popular genres of a user's saved tracks.
- Starts the Express app on a specified port, with CORS enabled.
GET /login
GET /recommendation/bytopsongs
GET /recommendation/byartistandgenre
GET /recommendation/byrecentlyplayed
To run this project you have to add these variables to your .env file
CLIENT_ID
CLIENT_SECRET
REDIRECT_URI
PORT
npm install
npm run devStart
https://open.spotify.com/playlist/6oeVHOTnNE5NhSHqyJcKnq?si=e1e7b33a59c84854