Skip to content

Spring JPA Back-End of mobile group payment app

hkdragon9/HashWolf2_BackEnd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HashWolf2_BackEnd

Setup

If you do not have MySQL Server downloaded, find it here: https://dev.mysql.com/doc/refman/8.0/en/installing.html

Once downloaded, create a MySQL server. To run the code locally, make MySQL available at port 3306 with password=root. Alternatively you could set database connection in .hashwolf2/src/main/resources/application.properties

Create a new schema in your MySQL server named hashwolf2, then import data from DatabaseDump.sql to the schema. These could be done in MySQL Workbench.

Run

Under hashwolf2 folder, run:

mvn clean spring-boot:run

Once the application starts, you should expect to see a few JSON objects printed at http://localhost:8080/hashwolf2/all. They should match the rows in MySQL Table user.

API Documentation:

  1. /all:
  • display all the data entries currently in your database

  • e.g. http://localhost:8080/hashwolf2/all

  1. /add:
  • add a User instance to the user TABLE

  • note that this must be used along with Postman (as far as I know).

  • Postman can be found here: https://www.getpostman.com/

  • e.g. http://localhost:8080/hashwolf2/add

(Note: the params after "add" doesn't matter, so you can add add?user_name = ??? etc but those params don't take into account)

  1. /insert:
  • insert a User instance to the user TABLE, with the params specified in your url

  • note that it must follow the format: insert?user_userID={user_id}&user_name={name}&user_email={email} though the params can be null.

  • e.g. http://localhost:8080/hashwolf2/insert?user_userID=250&user_name=oski&user_email=oski@ucb.com

Q&A:

Q: Error message like xxx must have a default value or DataBaseSeeder failed to run.

A: The problem is that the primary key entry must be set with some default value: Open your DBMD application (Navicat in my case), in the query section, enter the following database query for the relevant database table:

ALTER TABLE user ALTER UserID set DEFAULT 0;  

ALTER TABLE user MODIFY COLUMN userID INT auto_increment

About

Spring JPA Back-End of mobile group payment app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •