Movie Database api
- Golang v1.20+ , currently i used version 1.21.1
- MariaDB v.10.2+
- migrate
- Git
$ git clone git@github.com:mqnoy/movie-rest-api.git
$ cd movie-rest-api
$ go get
-
Open the project directory with code editor eg: Visual Studio Code
-
Open the terminal
-
Install dependencies type in terminal
go get
-
Navigate to your mysql client then create database eg:
movie_db
-
Back to terminal in vscode then run migration
migrate -path migration/script -database "mysql://your-db-username:your-db-password@tcp(127.0.0.1:3306)/movie_db" up
-
Copy
.env.example
to.env
in root project directory -
Edit variable on
.env
for detail see the tableVariabel description Example value SERVER_HOST Server listen all interface 0.0.0.0 SERVER_PORT Server listen port 8080 MYSQL_HOST mysql host localhost MYSQL_PORT mysql port 3306 MYSQL_USERNAME user mysql root MYSQL_PASSWORD password user mysql your-password-root MYSQL_DB_NAME database name movie_db -
Run service
go run main.go
- Viper - for handle configuration
- GORM - Orm for golang with mysql driver
- gin-gonic - http server (routing, middleware)
- validator - validator tag based
- zerolog - logging
- Support with unit test and mocking