-
Install node modules:
npm install
-
Configure the following variables in .env to match the following sample config
APP_PORT = 3000 MAX_SLOTS = 30 MAX_ITEMS_PER_SLOT = 15 ALLOWED_DENOMS = PENNY,NICKEL,DIME,QUARTER,HALFDOLLAR,DOLLAR
-
Run the application in development mode via:
npm run start:dev
-
Add items to a slot via POST /items with the following payload
{ "name": "Vegemite", "unitPrice": 12, "quantity": 100 }
-
Fetch the list of slots and the items located therein via GET /slots
-
Update the items within a slot via PATCH /slots with the following optional body params
{ "quantity": 39, "unitPrice": 3 }
-
Fetch the various denominations available in the vending machine coffer via GET /coins
-
Update the denominations available in the coffer via PATCH /coins and the following optional body params:
{ "dollarCount": 3, "halfDollarCount": 320, "quarterCount": 5, "dimeCount": 34, "nickelCount": 4, "pennyCount": 2 }
-
Make purchases via POST /payments with a slotId and optional denominational amounts:
{ "dollarCount": 1000, "dimeCount": 34, "nickelCount": 4, "pennyCount": 2 "slotId": 3 }