$ make
go get
$ make run
$ make api-docs
or
$ swag init -g ./api/main.go
make run
and go to http://localhost:8080/documentation/index.html$ make build
or
$ go build -o ./tmp/auth-server ./api/main.go
auth-server
in folder tmp, that file is an executable with the main in ./api/main.gochmod +x ./tmp/auth-server
./tmp/auth-server
$ make build-for-mac
$ make build-for-windows
go vet
and go fmt
for simple linter and formatting, running make format
will do.$ make lint
or
$ golangci-lint run
InitializeLogger
InitializeLogger
before using the Log
function, here's an example.env
mechanism that we all know, for more information here's the library.env
file that's explain in the library above OR use this one in this other library.env
file.env
file with a different port than the default, you will see how the web server is initialize in the port you specified in the .env
, you can just change the name of .env-template
to .env
and that will do the trick.$ make test
or
$ go test -cover -v ./...
_test
, if you see the example in test folder you will get it right away.$ make test
$ make coverage
$ make coverage-html
This project uses an SQLite database as default storage, for now this will be the only storage capability of the project. Possibly in the future we will have different ways of providing external storage to the system.
We are also using an ORM library.
$ make build
or $ go build -o <destination_of_executable_relative_to_root> <path_of_main_file_relative_to_root>
$ make run
or $ go run <path_of_main_file_relative_to_root>
$ chmod +x <path_to_executable_relative_to_root>
$ <path_to_executable_relative_to_root>
At the time of configuration we used Docker version 19.03.1 and Docker Compose version 1.24.1
In order to run this container you'll need docker and docker-compose installed.
You will also need to configure the .env
in the root of the project, please read the environment section.
To run the container you should run:
$ make docker-run
If you need to build the image:
$ make docker-build
Behind the scenes we are using docker-compose, but you could build and run the same configuration using docker:
$ docker build -f build/package/Dockerfile -t authentication_api .
$ docker run -d --env-file=.env -p 9000:9000 --name authentication_api authentication_api
If you want more information about all the folders being used in this project please refer to the original template. Thanks for the authors of this one!