Skip to content

csokun/bakery

Repository files navigation

Bakery Code Challenge

The challenge is implemented as an API. Hence, there is no UI component for test drive. However, two test suites are given:

  1. Unit Test - for functionalities testing npm test
  2. End-2-end - for integration testing npm run e2e

To launch the application simply run npm start

System requirement:

  • Node v8.x.x

Deployment

System requirement:

docker-compose up

The application will be up and running on port :3000 or visit live demo https://bakery-shop.herokuapp.com/

Demo Screenshot

API Interaction

System requirement:

  • Postman Chrome add-on or REST complaint client

Place Order

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
}]

Heartbeat

Navigate to http://localhost:3000/ping to check the service status.

Kill

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published