Coupons is a nodejs-angular app powered by cloudboost.io for creating discount coupons
Clone this project
$ git clone https://github.com/CloudBoost/Coupons.git
Install all dependencies
$ cd Coupons
$ npm install
This coupon uses cloudboost database service.
- Go to cloudboost.io's dashboard and create an app.
- Click on 'App Keys' Button
- Go to 'Manage App'.
- Create a table 'Coupon'
Table Schema
- code - textdescription - text
- percentage - boolean
- amount - number
- limit - number
- validFrom - DateTime
- validUntil - DateTime
- redemCount - number
CB.CloudApp.init('appId', 'appKey'); //replace appId and appKey with your app's appId and appKey
$ node server.js
Generate a random string for coupon code
$http.get("/generate/code"); //returns a string
Apply a Coupon
$http.post("/apply", {"couponId":'ABCD234', "amount":1200}); //retruns total discount on 1500 for given coupon code.
Redeem a Coupon
$http.post("/redeem", {"couponId":'ABCD234', "amount":1200}); //retruns total discount on 1500 for given coupon code and also increase value of redeem count.
Delete a Coupon
$http.post("/delete", {"couponId":'ABCD234'});
Get List of Coupon
$http.post("/couponlist"); //returns list of coupons