Simple API to fetch quotes and add quotes.
A couple of things that you will need to set up the API up and running.
-
You will need to install the Go 1.18 in order to run the application.
-
Docker and Docker Compose
You will need to install Docker & docker compose in order to run services the application uses.
Installation of dependencies can be done by running the following command:
make install
This install dependencies.
Before running the application, first setup environment variables.
cp .env.sample .env
sets up environment variables from .env.sample file. Set these environment variables approprately. The db configuration settings have been set to reasonable defaults.
now run the services specified in docker-compose.yml file.
docker-compose up
Now we can run the application with the following command:
make run
# or
go run app/cmd/main.go
This will run the application on port 8080.
Testing the application can be done by running the following command:
make test
Runs the tests.
Running test coverage can be done with:
make test-coverage
Applicationg linting can be done by first setting up golangci-lint:
make setup-linting
This installs the golangci-lint tool in the bin directory.
Now, linting can be run with the below command:
make lint
Runs linting.
Additionally, linting can be done on the Dockerfile with hadolint.
make lint-docker
This will run linting on the Dockerfile.
This uses Docker to run the linting.