The challenge is: "Create a Backend file processor project"
This project involves the development of a backend application in Python that allows for the upload and validation of flat files (.txt or .csv) through an interface. The application processes the data, inserts the records into a database using an ORM (Object-Relational Mapping), and enables querying each record by its ID.
- Docker installed on your machine (Install Docker)
Add and set .env in project root with the vars:
POSTGRES_PORT=5432POSTGRES_HOST=dbPOSTGRES_DB=postgresPOSTGRES_USER=postgresPOSTGRES_PASSWORD=postgres
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?sslmode=disable"
IMAGE_NAME=file_processor
Follow the next steps to build the python and db containers:
-
Open a terminal.
-
Navigate to the directory of the project.
-
Run the following command:
docker compose build --no-cache docker compose up
To run test, you can run the following commands:
```
make build
```
This command will build from scratch the containers,
up them and run test, afterward leave the exec container mode.
Or run the tests once the image and containers are up and running
```
make test
```
Now you can consume the api on your localhost via insomnia/postman: http://localhost:80 and url path, or use it in via swagger http://localhost/docs
-
Access the API Documentation
- Go to
http://localhost/docsto use the API via Swagger. You can use the attached files in the repository or upload your own.
- Go to
-
POST Endpoint
-
GET Endpoint





