Git Product home page Git Product logo

rkspce's Introduction

Farmer's Market Implementation

It's on like Donkey Kong!

Run

Docker

# Build image:
docker build -f build/Dockerfile -t farmers .

# Start server:
docker run -it -p 10010:10010 -e HOST=:10010 farmers

# Create a basket:
curl -X POST localhost:10010/api/basket
# Output:
#
# {"basket":{"id":"bt9pit05st6c7r2p61s0","items":null}}

# Add coffee to basket:
curl -X PATCH localhost:10010/api/basket/bt9pit05st6c7r2p61s0/product/CF1
# Output:
#
# {"basket":{"id":"bt9pit05st6c7r2p61s0","items":[{"code":"CF1","price":11.23,"discounts":null}]}}

# Add more coffee to basket:
curl -X PATCH localhost:10010/api/basket/bt9pit05st6c7r2p61s0/product/CF1
# Output:
#
# {"basket":{"id":"bt9pit05st6c7r2p61s0","items":[{"code":"CF1","price":11.23,"discounts":null},{"code":"CF1","price":11.23,"discounts":[{"code":"BOGO","price":-11.23}]}]}}

# Add still more coffee to basket and print it as plain text:
curl -X PATCH localhost:10010/api/basket/bt9pit05st6c7r2p61s0/product/CF1?format=txt
# Output:
#
# Basket: bt9pit05st6c7r2p61s0
# Item                          Price
# ----                          -----
# CF1                           11.23
# CF1                           11.23
#             BOGO             -11.23
# CF1                           11.23
# -----------------------------------
#                               22.46

#
# Add many more products to the basket !
#

# Get basket and print it as plain text:
curl -X GET localhost:10010/api/basket/bt9pit05st6c7r2p61s0?format=txt
# Output:
#
# Basket: bt9pit05st6c7r2p61s0
# Item                          Price
# ----                          -----
# CF1                           11.23
# CF1                           11.23
#             BOGO             -11.23
# CF1                           11.23
# CF1                           11.23
#             BOGO             -11.23
# CF1                           11.23
# CF1                           11.23
#             BOGO             -11.23
# MK1                            4.75
#             CHMK              -4.75
# MK1                            4.75
# MK1                            4.75
# OM1                            3.69
# OM1                            3.69
# OM1                            3.69
# AP1                            6.00
#             APOM              -3.00
#             APPL              -1.50
# AP1                            6.00
#             APPL              -1.50
# AP1                            6.00
#             APPL              -1.50
# CH1                            3.11
# -----------------------------------
#                               67.87

rkspce's People

Stargazers

Sonu Giri avatar

Watchers

James Cloos avatar Anri Digholm 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.