/musicbase-backend

Backend repository for MusicBase - build with Node.js, Express.js & MySQL database. See live:

Primary LanguageJavaScript

MusicBase Backend

This is the backend repository for MusicBase, a web application for searching artists, albums, and songs. The app is build with Node.js, Express.js and MySQL.

Deployed app

Local Development

To run the backend server locally, follow these steps:

Prerequisites

  • Node.js and npm (Node Package Manager)
  • MySQL Database

Fork and Clone

  1. Fork this repository by clicking the "Fork" button in the top right corner of the GitHub page.
  2. Clone the repository to your local machine using the following command in your terminal:
git clone https://github.com/osman-butt/musicbase-backend.git

Install Dependencies

Navigate to the project directory and install the necessary dependencies:

cd musicbase-backend
npm install

Setting Up Local Database

  • Ensure you have a MySQL server running on your local machine.
  • Create a new database named musicbase.
  • Import the provided SQL dump file into the musicbase database to set up the initial schema and data. The file can be found here by running the command
mysql -u username -p musicbasedb < path/to/musicbasedb.sql
  • Create a .env file a fill it with your database information
MYSQL_HOST=localhost
MYSQL_USER= ENTER YOUR USERNAME
MYSQL_DATABASE= musicbasedb
MYSQL_PASSWORD= ENTER YOUR PASSWORD
MYSQL_PORT=3306

When you run the server it will now use the local MySQL database

Running the server

Start the server using the following command:

npm start