RESTful APIs created for serving a money tracker web application using GoFr.
-
Download and install Go.
-
Download Docker and set it as a background service.
-
Start a mysql docker container with the following command:
docker run --name gofr-mysql -e MYSQL_ROOT_PASSWORD=root123 -e MYSQL_DATABASE=test_db -p 3306:3306 -d mysql:8.0.30
-
Connect to the bash of the created terminal:
docker exec -it gofr-mysql bash
-
Create
user
andrecord
tables with the following schema:create table user(email varchar(255) NOT NULL);
create table record( id int PRIMARY KEY NOT NULL AUTO_INCREMENT, email varchar(255) NOT NULL, date varchar(255) NOT NULL, amount DECIMAL(10, 2) NOT NULL, description varchar(255));
-
Create a file with name
.env
insideconfigs
folder with the following content:APP_NAME=gofr-moneytracker HTTP_PORT=8080 DB_HOST=localhost DB_USER=root DB_PASSWORD=root123 DB_NAME=test_db DB_PORT=3306 DB_DIALECT=mysql
-
Execute the commands inside our repository's directory in order to install the dependencies and run the project:
go mod tidy
go run main.go
You can view and test the APIs using this Postman collection or can import the collection using /ZopSmart.postman_collection.json
inside Postman.