This README document guides you through setting up your local development environment for the backend of the Viktig project.
Before setting up the MySQL database, you need to clone the repository, set the Node.js version, and install the dependencies:
- Clone the repository
Clone the repository using the following command:
git clone https://github.com/Satalicious/da_backend.git
- Set Node.js version
Ensure that you're using the correct version of Node.js with nvm:
nvm use
- Install dependencies
Install the necessary dependencies using yarn:
yarn
After the pre-setup is complete, follow these steps to setup your MySQL database:
Step 1: Setting up MySQL Database
- Access MySQL shell
mysql -u root
# OR in case of access issues
sudo mysql -u root
- Create new MySQL user
Substitute <your_username> with your chosen MySQL username:
CREATE USER '<your_username>';
- Create the 'viktig' database
CREATE DATABASE viktig;
- Grant privileges
GRANT ALL PRIVILEGES ON viktig.* TO '<your_username>'@'%';
- Set password for new user
Set the password for your user by replacing <your_password>:
ALTER USER '<your_username>'@'%' IDENTIFIED BY '<your_password>';
- Flush privileges
FLUSH PRIVILEGES;
- Verify the creation of the database
SHOW DATABASES;
- Update Environment Variables
Update your .env file as follows:
PORT=3306
HOST=127.0.0.1
DB_USER=<your_username>
PASSWORD=<your_password>
After following these steps, the backend application should be ready to connect to your MySQL server.
The users you want to create initialy should be entered in the users.json, following the same syntax as the example users.
To run it:
yarn dev
This project is licensed under the MIT License. See the LICENSE file for details.