- Root directory /
- Have goolang installed and configured on your machine.
- Have an IDE with support to Go programming language.
git clone https://github.com/matcampos/api-golang.git
before you run the project you need to configure the environment variable files.
Are them:
- .env - The .env.sample file shows all fields which this file need.
- docker.env - The same content of .env-sample file but with your docker container configurations, and DATABASE_HOST env value must be "database".
- sql.env - The sql.env.sample file shows all fields which this file need.
Execute the following command to install all dependencies of the project.
go get -d -v ./...
To execute the project on your local machine run the following command on root directory of the project:
go run main.go
To build the project execute the following command
go install
- to run this build go on terminal in the root directory of the project and enter:
api-golang
Another option to build and run the it is the following command:
go build main.go && ./main.go
To build the and run the project with docker you must configure the docker.env file, then you run the following command on root directory of the project.
docker-compose up -d
- go1.15 darwin/amd64 - Golang framework and go language download link.
- errors - Library to get the stackTrace of any error on go.
- my-sql - Library to use mysql database on golang.
- godotenv - Library to use .env files and set the environment variable on golang.
- jwt-go - Library to use jwt token on golang api.
- ozzo-validation - Library to validate structs properties.
- gorilla/mux - Library to create api endpoints on golang.
- Matheus Campos - Full-Stack Developer - Github