The project proposes a solution with an API that receives a file and returns it split into 50 lines each, along with a user interface for easy interaction.
In your terminal, clone the project.
Rename the .env.example.rb
file to .env
and replace the database values according to your preference.
Build the application containers and settings:
docker compose build
In your terminal, after running docker-compose build
, start the application with:
docker compose up
In Postman, access the url http://localhost:3000/api/v1/import
In Body, select form-data, set the key csv_file
and choose the file. (The app has a template file in spec/fixtures/files/customer_data_100.csv)
Set the key email
and enter any email address.
Go to http://localhost:3000/letter_opener/ and check if the email has arrived.
When you click Send, the following message should appear:
File received successfully! Please check your email in a few minutes.
To stop the application:
docker compose down
To access the database: Start the container terminal:
docker exec -it csvsplitter /bin/bash
Once in the container, access the console:
rails c
Within the console it's possible to access the requests by typing the command below:
ImportData.all
To exit the console:
exit
In your terminal, after running docker-compose build
, start the application with:
docker compose up
- Access the url http://localhost:3000;
- Add any valid email, a csv file and click on "Split csv";
- In development, go to http://localhost:3000/letter_opener/ and check if the email has arrived;
To stop the application:
docker compose down
This project is also pre-configured to receive emails in production.
To do so, replace the variables below on the .env
file with your preferred values:
MAIL_USER = your_delivery_email@email.com
MAIL_PASSWORD = your_password
(*For gmail, you may need to enable two-step verification and use app password as described here).
Start the container terminal:
docker exec -it csvsplitter /bin/bash
Run the test command:
rspec