Siena's challenge for the Senior Backend Engineer position
This project used Node.js + Express.js. It also used LocalStack to simulate AWS cloud locally and Postgress as database.
!!! The Prompt Engineering details are located on ./PROMPT_ENGINEERING.md
.
-
You need to have Docker and Docker-compose installed.
- Bring project dependencies up with docker-compose.
docker compose up -d
# the project uses Localstack to run AWS services locally
# It also uses a Postgrees image
- Install dependencies with Yarn and run database migrations and seeds.
yarn setup
# this will run yarn install and the migrations command.
- Copy
.env.example
file to.env
.
- To run the project build.
yarn start
# this script will create the build and run it
- To run the project with file watch (for development).
yarn dev
If everithing went well, the terminal should look like this:
The repository alredy have everithing necessary to run some manual tests.
You can find a CSV sample file on ./assets/smallCsvSample.csv
.
- To test the
/upload
endpoint you can use the following Curl command or use the Postman / Insomnia collection located at./docs/siena-collection.json
.
curl --request POST \
--url http://localhost:5000/upload \
--header 'Content-Type: multipart/form-data' \
--header 'User-Agent: insomnia/8.6.1' \
--form file={PATH}/siena-backend-challenge/assets/smallCsvSample.csv
# use the example csv provided
# you can check the uploaded file on Localstck's S3 using the awslocal cli
- To test the
/conversation
endpoint (after the upload of the sample csv file) you can run the following Curl command.
curl --request GET \
--url 'http://localhost:5000/conversation?limit=1&skip=0' \
# change the pagination parameters as needed
- To test the
/conversation/:id/message
endpoint, you can run the following Curl command. Use the above endpoint to get aconversation
ID.
curl --request GET \
--url http://localhost:5000/conversation/{some-id}/message \
To model the databade tables I've used TypeOrm
and Postgrees
.
The tables details can be viewed bellow.
To run the unit tests, just run the following command:
yarn test