This project contains the API and the frontend application to CodeBrain Challenge.
- Docker - with docker compose installed
OR
- Java 11+
- MySQL 8+
- NodeJS
You can run this project using Docker containers - started with a single command using Docker Compose - or using a development machine with Java, MySQL and NodeJS installed.
docker-compose up
cd api
./gradlew run # Or `gradlew.bat run` on Windows
cd front
npm i
npm run dev
curl --request POST \
--url http://localhost:8080/salespeople \
--header 'Content-Type: application/json' \
--data '{
"name": "John Doe",
"registration": "RG-85410"
}'
curl --request PUT \
--url http://localhost:8080/salespeople/:id \
--header 'Content-Type: application/json' \
--data '{
"name": "Jane Doe",
"registration": "RG-85411"
}'
curl --request DELETE \
--url http://localhost:8080/salespeople/:id \
--header 'Content-Type: application/json'
curl --request GET \
--url http://localhost:8080/salespeople/:id \
--header 'Content-Type: application/json'
curl --request GET \
--url http://localhost:8080/salespeople?registration=:registration \
--header 'Content-Type: application/json'
curl --request POST \
--url http://localhost:8080/products \
--header 'Content-Type: application/json' \
--data '{
"name": "Test Product",
"price": "999",
"imageUrl": "https://via.placeholder.com/150"
}'
curl --request PUT \
--url http://localhost:8080/products/:id \
--header 'Content-Type: application/json' \
--data '{
"name": "Test Product Updated",
"price": "444",
"imageUrl": "https://via.placeholder.com/150"
}'
curl --request DELETE \
--url http://localhost:8080/products/:id \
--header 'Content-Type: application/json'
curl --request GET \
--url http://localhost:8080/products/:id \
--header 'Content-Type: application/json'
curl --request GET \
--url http://localhost:8080/products?id=:id \
--header 'Content-Type: application/json'
curl --request GET \
--url http://localhost:8080/products?name=:name \
--header 'Content-Type: application/json'
curl --request POST \
--url http://localhost:8080/sales \
--header 'Content-Type: application/json' \
--data '{
"salespersonId": 2,
"products": [
{
"id": 1,
"quantity": 1
},
{
"id": 2,
"quantity": 2
}
]
}'