This is a test case for second step of selection for Software Engineering School 4.0
- Docker
- Docker Compose
- Clone the repository
git clone https://github.com/myroslavve/genesis-test-case.git
- Navigate to the project directory
cd genesis-test-case
- Copy the
.env.example
file to a new file named.env
:
cp .env.example .env
- Update the
.env
file with your own values for SMTP server and database.
To build and run the application using Docker Compose:
docker-compose up --build
This command will start the MongoDB container, build the Go application, run the migrations, and start the application.
The application will be available on localhost:8080
- Endpoint:
/api/rate
- Method:
GET
- Description: Retrieves the current exchange rate from USD to UAH.
- Response:
200 OK
: Returns the current exchange rate as a JSON number.400 Bad Request
: Invalid request.
- Endpoint:
/api/subscribe
- Method:
POST
- Description: Subscribes an email to receive current exchange rate updates.
- Request:
- Content-Type:
application/x-www-form-urlencoded
- Parameters:
email
(string, required): The email address to subscribe.
- Content-Type:
- Response:
200 OK
: Email added successfully.409 Conflict
: Email already exists in the database.