fake-e-commerce
v1.0.10
Published
a package to manage a fake e-commerce
Downloads
39
Readme
E-commerce simulator
a simple package with functions to manage a product array
Install
$ npm install fake-e-commerce
Usage
var products = require('fake-e-commerce');
Get all the products from your array with get()
.
products.get();
Get a product by id with getProductById(id)
.
products.getProductById(id);
Add a new product with addProduct(name, quantity, price)
. The package will automatically assign an id to the new product.
products.addProduct(name, quantity, price);
Delete a product by id with deleteProduct(id)
.
products.deleteProduct(id);
Buy a product by id product and token with buy(id, token)
. The package will automatically assign an id to the new product. later through the api you can manage the permissions.
products.buy(id, token);
Modify a product with updateProduct(name, quantity, price)
. you can modify even just one of the properties.
products.updateProduct(name, quantity, price);
Get all sales products with soldProducts()
.
products.soldProducts();
Get all products bought by an user through his token soldProducts()
.
products.getSalesByToken(token);
Reset original product array with reset()
.
products.reset();