boletia-currency-api
Overview
This app represents a tech challenge from Boletia. It is a RESTful API for historical currency rate values, developed in
Go, incorporating features such as JWT Authentication, rate limiting, Swagger documentation, caching with Redis, and
database operations through GORM. The application utilizes the Gin Gonic web framework and is containerized using
Docker.
Additionally, it includes a daemon that periodically consults the currency API's "/latest" endpoint every few minutes
and populates the database with the obtained data.
Getting Started
Prerequisites
Installation
- Clone the repository
git clone https://github.com/wjoseperez20/boletia-currency-api.git
- Navigate to the directory
cd boletia-currency-api
- Build and run the Docker containers
make setup && make build && make up
Environment Variables
Local: You need to put some important information into a file called .env on your computer.
POSTGRES_HOST
POSTGRES_DB
POSTGRES_USER
POSTGRES_PASSWORD
POSTGRES_PORT
JWT_SECRET
API_SECRET_KEY
DAEMON_WAKEUP
CURRENCY_API_ENDPOINT
CURRENCY_API_KEY
CURRENCY_API_TIMEOUT
In .env.sample you can find an example of the .env file.
API Documentation
The API is documented using Swagger and can be accessed at:
http://localhost:8001/swagger/index.html
Usage
Authentication
To use authenticated routes, you must include the Authorization
header with the JWT token.
curl -H "Authorization: Bearer <YOUR_TOKEN>" http://localhost:8001/api/v1/currencies