quote-api

Quote API

MIT License

Stars
0
Committers
3

Quote API

Simple API to fetch quotes and add quotes.

Requirements

A couple of things that you will need to set up the API up and running.

  1. Go

    You will need to install the Go 1.18 in order to run the application.

  2. Docker and Docker Compose

    You will need to install Docker & docker compose in order to run services the application uses.

Installation

Installation of dependencies can be done by running the following command:

make install

This install dependencies.

Running the application

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

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

Linting application

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.

Package Rankings
Top 8.17% on Proxy.golang.org
Badges
Extracted from project README
License Version Tests Lint Build Codacy Badge codecov Go
Related Projects