Code Monkey home page Code Monkey logo

bakery's Introduction

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.

bakery's People

Contributors

csokun avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.