This project aims to develop an application similar to TIX-ID, a well-established platform for booking tickets online. There is three roles here
- Admin*
- Customer*
- Guest
*Need Authentification
The program uses go-gin as the framework, MySQL as the database, and using go-migrate for database migrations
It also employs various libraries:
To view the API documentation, you need to create /docs
directory by running the following command in the terminal:
swag init
and open <URL>/swagger/index.html
Before starting the program, you need to set the .env
file first:
- Create
.env
file in the root directory - Copy the enviroment variables from
.env.example
- Fill the variables
Ensure that you have installed go-migrate. Before migrating the database, create a database in your MySQL.
To run the database migrations:
- UP Migration
migrate -path config/migrations -database "<database_address>" up
- DOWN Migration
migrate -path config/migrations -database "<database_address>" down
"Note: Replace
database_address
withmysql:https://user:password@tcp(host:port)/dbname?query
"
To start this project in docker:
- Build the Docker Compose first
docker compose build
- Execute the Docker Compose useing 'up' command
this docker will run in port
docker compose up
80
- Stopping Docker Compose
docker compose down
- Migrate Database in Docker
docker run -v {{ migration dir }}:/config/migrations --network host migrate/migrate -path=/config/migrations/ -database mysql:https://user:password@tcp(host:port)/dbname?query up