Skip to content

pfilatov92/food-shop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

food-shop

simple Node.js API for food shop

Requirements:

  1. Node.js v 6.10.0

How to use:

  1. Open './config/config.json' and specify all needable data (mongoUri, port, deleteTimeout). To install mongoDB you can use 'https://1cloud.ru/help/linux/Ustanovka-MongoDB-na-Ubuntu' for Ubuntu.
  2. install node modules: "npm install"
  3. fill test DB: "node ./lib/fillDb" (data is retrieving from ./config/config.json)
  4. run tests: "npm test" (Note that it used test db in tests)
  5. run application "npm start"

Requests could be send for example with Postman (https://www.getpostman.com/):

  1. get available products list: GET localhost:3000/api/products
  2. get your cart: GET localhost:3000/api/cart (cart is identified by sessionID and will be deleted in 5 min after last activity with cart)
  3. add product to cart: POST localhost:3000/api/cart Body={ "product_id": "2", "quantity": 2 } (quantity should be integer in range [1,10])
  4. delete product from cart: DEL localhost:3000/api/cart Body={"product_id": "2"}

About

simple Node.js API for food shop

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published