Skip to content

Quick Start

Nisarag edited this page May 24, 2020 · 4 revisions

Quick Start

To quickly use this website (and not run locally) then

Go to: https://metrinom.herokuapp.com/

If you want to run this project locally then follow the instructions below

Prerequisites:

  • You have cloned this repository onto your local machine

  • Node.js (Make sure your node version is more than 11 or the server might crash, this is because some functions such as flat() (which is used in the backend) from ES2019 require node version 11 or higher)

  • Npm (However this does come with Node.js)

  • MongoDB community server

  • A code editor (VS code was used in the development of this project)

Project setup:

Server

  1. Open your terminal and cd into the server directory in server

  2. Run npm install inside of the server directory

  3. Create a .env file in the ./client folder with the following attributes:

SPOTIFY_CLIENT_ID=<your id>
SPOTIFY_CLIENT_SECRET=<your secret>
Steps to generate these secrets

Go to: https://developer.spotify.com/dashboard/applications and create a new application, after the application has been created you will see that a Client Id and a Client Secret has been generated. Paste these into the environment file above.

  • A sample file .env will look like this
SPOTIFY_CLIENT_ID=asf124asfasf112
SPOTIFY_CLIENT_SECRET=fasfj25j122
  1. Add redirect URI to the spotify application
Steps to add redirect URI

To do this, go to your application the spotify dashboard; you will see this at the top of your page:

Screen Shot 2020-05-24 at 5 22 47 PM

Click on Edit Settings and add http://localhost:3001/auth/spotify/callback as a redirect URI:

Screen Shot 2020-05-24 at 5 40 06 PM

You will then see this when added:

Screen Shot 2020-05-24 at 5 18 32 PM

  1. Make sure your MongoDB database is running locally by using the relevant commands to your operating system (Note this step is important else the server might crash if Mongo is not running on your computer). See here for more on details on running MongoDB locally.
Terminal output when database is not running locally and you attempt to start the server

Screen Shot 2020-05-24 at 8 00 38 PM

To fix this ensure MongoDB is running locally on your computer.

  1. After the .env file has been filled in and the redirect URI has been added. Ensure that port 3001 is not occupied else you will have to change the redirect URI above accordingly. In the server directory, run npm start in terminal to start the server.
Expected terminal output after starting server

Screen Shot 2020-05-24 at 5 34 17 PM

Client

  1. Open your terminal (while your server is running) and cd into the client directory for this project.
  2. Run npm install inside of the client directory
  3. Run npm start inside of the client directory and ensure you are on port 3000
Expected terminal output after starting client

Screen Shot 2020-05-24 at 5 40 06 PM

Expected browser output when going to http://localhost:3000/ on your browser

Screen Shot 2020-05-24 at 5 45 54 PM

After the client and server have started running, you can start using the app.

Clone this wiki locally