https://github.com/brianlusina/quote-api
Quote API
https://github.com/brianlusina/quote-api
docker go golang quotes quotes-api
Last synced: 3 months ago
JSON representation
Quote API
- Host: GitHub
- URL: https://github.com/brianlusina/quote-api
- Owner: BrianLusina
- License: mit
- Created: 2022-04-23T19:50:54.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-18T06:52:55.000Z (4 months ago)
- Last Synced: 2025-03-30T05:23:55.795Z (4 months ago)
- Topics: docker, go, golang, quotes, quotes-api
- Language: Go
- Homepage:
- Size: 510 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Quote API
[](https://github.com/brianlusina/quote-api/blob/main/LICENSE)
[](https://github.com/brianlusina/quote-api/releases)
[](https://github.com/BrianLusina/quote-api/actions/workflows/tests.yml)
[](https://github.com/BrianLusina/quote-api/actions/workflows/lint.yml)
[](https://github.com/BrianLusina/quote-api/actions/workflows/build_app.yml)
[](https://www.codacy.com/gh/BrianLusina/quote-api/dashboard?utm_source=github.com&utm_medium=referral&utm_content=BrianLusina/quote-api&utm_campaign=Badge_Grade)
[](https://codecov.io/gh/BrianLusina/quote-api)
[](https://go.dev/)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](https://golang.org/doc/install)
You will need to install the Go 1.18 in order to run the application.
2. [Docker](https://docker.com) and [Docker Compose](https://docs.docker.com/compose/install/)
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:
``` bash
make install
```> This install dependencies.
## Running the application
Before running the application, first setup environment variables.
``` bash
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.
``` bash
docker-compose up
```Now we can run the application with the following command:
``` bash
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:
``` bash
make test
```> Runs the tests.
Running test coverage can be done with:
``` bash
make test-coverage
```## Linting application
Applicationg linting can be done by first setting up golangci-lint:
``` bash
make setup-linting
```> This installs the [golangci-lint](https://github.com/golangci/golangci-lint) tool in the [bin directory](./bin).
Now, linting can be run with the below command:
``` bash
make lint
```> Runs linting.
Additionally, linting can be done on the [Dockerfile](./Dockerfile) with [hadolint](https://github.com/hadolint/hadolint).
``` bash
make lint-docker
```> This will run linting on the Dockerfile.
This uses [Docker](https://docker.com) to run the linting.