Skip to content

xxmathias/da_backend

Repository files navigation

Viktig Backend

This README document guides you through setting up your local development environment for the backend of the Viktig project.

Pre-setup

Before setting up the MySQL database, you need to clone the repository, set the Node.js version, and install the dependencies:

  1. Clone the repository

Clone the repository using the following command:

git clone https://github.com/Satalicious/da_backend.git
  1. Set Node.js version

Ensure that you're using the correct version of Node.js with nvm:

nvm use
  1. 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

  1. Access MySQL shell
mysql -u root
# OR in case of access issues
sudo mysql -u root
  1. Create new MySQL user

Substitute <your_username> with your chosen MySQL username:

CREATE USER '<your_username>';
  1. Create the 'viktig' database
CREATE DATABASE viktig;
  1. Grant privileges
GRANT ALL PRIVILEGES ON viktig.* TO '<your_username>'@'%';
  1. Set password for new user

Set the password for your user by replacing <your_password>:

ALTER USER '<your_username>'@'%' IDENTIFIED BY '<your_password>';
  1. Flush privileges
FLUSH PRIVILEGES;
  1. Verify the creation of the database
SHOW DATABASES;
  1. 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

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published