This is a quick start guide for setting up the backend database of Updog
This guide assumes you have already cloned the repository and installed Node.js v14.x or later
-
In the "Choosing a Setup Type" page of the installer, select "Developer Default"
-
Click "next" (using default settings) until you reach the "Accounts and Roles" page
-
Add a root password for yourself
-
Click "Add User" and create a user with username "updogDev" and password "password"
-
Continue to click "next" or "execute" until the install process is done
- In MySQL Workbench, click Database->Manage Connections
- Click "Test Connection" and input the root password you set up earlier if prompted
- If successful, a popup similar to below should appear:
- Create a new connection with the following settings:
username: 'updogDev'
password: 'password'
connection name: 'updog'
-
Click the home icon, and open the connection you just made
-
Under "Users and Privileges"->"Administrative Roles", check that the updogDev user you created has the DBA (Database Admin) permission - if you followed the steps in the installer section you should already have this
-
Click the database icon on the toolbar to create a new schema with the name "updog", all settings default, and click "Apply"
-
If you haven't already, execute
npm install
in both the mainUpdog/
directory and in theUpdog/backend/
folder., thennpm install -g sequelize-cli
-
Execute the following to add the tables to the database via Sequelize ORM:
sequelize db:migrate:undo:all --url "mysql://updogDev:password@localhost:3306/updog"
sequelize db:migrate --url "mysql://updogDev:password@localhost:3306/updog"
To run all backend tests, run npm test
from the backend/
folder
To start the project, run npm start
To test connection, send a GET request to http://localhost:8080/api/test. Response should be "Hello World!"
Base URL: http://localhost:8080/api (Check routes folder or Swagger for endpoints)
Updog's API endpoints are documented using Swagger
To access, first run npm start
then go to the following URL: http://localhost:8080/api-docs
When adding new endpoints, ensure you update the documentation in the specs/swagger.yaml
file
If you receive a "Your password does not satisfy the current policy requirements" error, do the following:
-
Open MySQL Shell
-
run
SET GLOBAL validate_password.length = 4;
-
run
SET GLOBAL validate_password.policy=LOW;
If the "Test Connection" button fails, you may need to reinstall MySQL - sometimes the installation process doesn't work correctly.