This project integrates with the Spotify Web API to enable users to log in with their Spotify account, search for tracks, and control playback through an Express web application.
- User authentication with Spotify
- Search for tracks using Spotify's search API
- Control playback of Spotify tracks
Before you begin, ensure you have met the following requirements:
- You have installed Node.js and npm (Node.js package manager).
- You have a Spotify Developer account and have set up an application to obtain the
CLIENT_IDandCLIENT_SECRET. - You have set up a
.envfile in your project root with your Spotify credentials and the correctREDIRECT_URL.
To install the project, follow these steps:
- Clone the repo:
git clone https://github.com/adanzweig/nodejs-spotify.git
- Navigate to the project directory:
cd nodejs-spotify - Install the required dependencies:
npm install
To run the application, follow these steps:
- Start the server:
npm start
- Open your web browser and navigate to:
http://localhost:3050/login - Log in with your Spotify credentials.
- You will be redirected to use the
/searchand/playendpoints to search for tracks and control playback.
GET /login: Redirects to Spotify's login page.GET /callback: Handles the callback after Spotify login.GET /search: Searches for tracks based on a query parameterq.GET /play: Starts playback of a track based on the provided URI query parameter.
To contribute to this project, follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b branch-name. - Make your changes and commit them:
git commit -m 'commit message'. - Push to the original branch:
git push origin branch-name. - Create the pull request.
Alternatively, see the GitHub documentation on creating a pull request.
This project uses the following license: MIT License.
Thank you to the Spotify Web API and the creators of the spotify-web-api-node package for making this integration possible.