This service implements an API for subscribing to exchange rate updates via email (the current implementation focuses on the USD to UAH
exchange rate).
This endpoint returns the current USD to UAH
exchange rate using the Coinbase API.
No parameters
200: Returns the actual USD to UAH exchange rate.
400: Invalid status value.
This endpoint adds an email address to the database and automatically subscribes it to the USD to UAH exchange rate newsletter.
email
string (formData): The email address to be added to the database and the mailing list.
200: The email address is added to the database and subscribed to the mailing list.
409: The email address already exists.
Not mentioned in the task, but arose during the development process:
400: The provided data (such as email address) is invalid.
500: Internal error status.
This endpoint sends the current USD to UAH
exchange rate to subscribed email addresses using goroutines.
No parameters
200: Emails were sent.
Clone the repository to your local machine:
git clone https://github.com/vladyslavpavlenko/genesis-api-project.git
cd genesis-api-project
❗️Ensure you have a .env
file in the root directory with the necessary environment variables. The .env
should look like this:
EMAIL_ADDR=<EMAIL_ADDR>
EMAIL_PASS=<EMAIL_PASS>
DB_HOST=<DB_HOST>
DB_PORT=<DB_PORT>
DB_USER=<DB_USER>
DB_PASS=<DB_PASS>
DB_NAME=<DB_NAME>
For Unix-like systems, use the following command to build the application binary:
make up_build
For Windows systems, use the following command:
make -f Makefile.windows build_app
To start the Docker containers without forcing a build, run:
make up
To stop the Docker containers, run:
make down
Alternatively, you can use Docker Compose commands directly:
Start the containers without forcing a build:
docker-compose up -d
Build the application and start the containers:
docker-compose up --build -d
Stop the containers:
docker-compose down
The application will be accessible at http://localhost:8080/
.