Skip to content

mqnoy/movie-rest-api

Repository files navigation

Movie REST API

Movie Database api

Prerequisites

  1. Golang v1.20+ , currently i used version 1.21.1
  2. MariaDB v.10.2+
  3. migrate
  4. Git

Clone the project

$ git clone git@github.com:mqnoy/movie-rest-api.git
$ cd movie-rest-api
$ go get

Get Started

  1. Open the project directory with code editor eg: Visual Studio Code

  2. Open the terminal

  3. Install dependencies type in terminal go get

  4. Navigate to your mysql client then create database eg: movie_db

  5. 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
    
  6. Copy .env.example to .env in root project directory

  7. Edit variable on .env for detail see the table

    Variabel 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
  8. Run service go run main.go

Library that i use

TODO

  • Support with unit test and mocking

Postman Collection

Contributor

About

Movie Database api

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages