https://github.com/juanitosebastian/drinks-app
A coding assignment for a job application
https://github.com/juanitosebastian/drinks-app
docker docker-compose express nginx react typescript
Last synced: 2 months ago
JSON representation
A coding assignment for a job application
- Host: GitHub
- URL: https://github.com/juanitosebastian/drinks-app
- Owner: JuanitoSebastian
- Created: 2023-02-28T12:09:03.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-28T12:48:45.000Z (over 3 years ago)
- Last Synced: 2025-06-28T22:48:58.135Z (12 months ago)
- Topics: docker, docker-compose, express, nginx, react, typescript
- Language: TypeScript
- Homepage:
- Size: 120 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ☕️ Drinks App
A small web application for saving your favorite coffees and teas. The front end is a Typescript React (Vite) and the back end is Typescript Express.
## 🏃 Running a production build
You have to have [docker and docker-compose installed](https://docs.docker.com/compose/install/) for running the application.
1. Clone the repository by running `git clone https://github.com/JuanitoSebastian/Drinks-App.git`
2. Open terminal at the root of the repository and run `docker compose up`
3. The application launches at `localhost:80`
## 🛸 Running tests
The application features integration tests for the back end created with jest and supertest. You have to have [docker and docker-compose installed](https://docs.docker.com/compose/install/) for running tests.
1. Clone the repository by running `git clone https://github.com/JuanitoSebastian/Drinks-App.git`
2. Open terminal at the root of the repository and run `docker-compose --file test.docker-compose.yml up`
## 📡 API endpoints
### Fetch many drinks
```
GET /api/drinks?type={{type}}&search={{search}}
```
| Parameter | Type | Required? | Description |
|-----------|--------|-----------|---------------------------------------------------|
| type | enum | no | Type of drink. Enum values: **coffee** or **tea** |
| search | string | no | Search by name of drink. |
**Example response**
```
{
"data": [
{
"id": "912045b0-b5db-11ed-ac2e-4df5eed4e12c",
"type": "tea",
"name": "Dreamy Mountains",
"price": 2.2,
"roast": 2,
"weight": 500
},
{
"id": "939c1b20-b5db-11ed-ac2e-4df5eed4e12c",
"type": "coffee",
"name": "Lucaffe Mamma Lucia",
"price": 22.9,
"roast": 4,
"weight": 500
}
]
}
```
### Create new drink
```
POST /api/drinks
```
Endpoint for creating new drinks. Successful creation returns the created Drink.
- name: string
- type: enum, supported values coffee and tea
- price: number
- roast: number, integer from 1 to 5
- weight: number, weight in grams
**Example request body**
```
{
"name": "MokaSirs Intenso",
"type": "coffee",
"price": 7,
"roast": 5,
"weight": 1000
}
```
**Example response**
```
{
"data": {
"id": "37ffd620-b730-11ed-ab99-c938791196c1",
"name": "MokaSirs Intenso",
"type": "coffee",
"price": 7,
"roast": 5,
"weight": 1000
}
}
```