The challenge is implemented as an API. Hence, there is no UI component for test drive. However, two test suites are given:
- Unit Test - for functionalities testing
npm test
- End-2-end - for integration testing
npm run e2e
To launch the application simply run npm start
System requirement:
- Node v8.x.x
System requirement:
- Docker installed
docker-compose up
The application will be up and running on port :3000
or visit live demo https://bakery-shop.herokuapp.com/
System requirement:
- Postman Chrome add-on or REST complaint client
POST http://localhost:3000/orders
Payload:
{
"orders": [
{ "code": "VS5", "qty": 10 },
{ "code": "MB11", "qty": 14 },
{ "code": "CF", "qty": 13 }
]
}
Sample Response:
[{
"order": {
"code": "VS5",
"qty": 10,
"total": 17.98
},
"result": [
{ "unit": 2, "qty": 5, "price": 8.99 }
],
"error": null
}]
Navigate to http://localhost:3000/ping
to check the service status.
Use this endpoint to kill the server process. This will simulate the system down scenario and pm2
will bring the system backup.
POST http://localhost:3000/kill
It is higly recommend that you visit http://localhost:3000/ping
after invoke this kill
operation to confirm that the system is still running.