Routes - Coupons

File Name : coupons.js
File Path : /server/routes/coupons.js
Favourite route contains getCoupons . These functionalities are included in Coupons Controller.

Get Coupons Route

  1. API Path: api/Coupons/getCoupons
  2. Method: GET
  3. Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
  4. Parameters:

    • Name: req
    • Type: Object

    • Name: jwtAccessToken

    • In: Header
    • Type: String
    • Description: JWT access token is used to check the authenticity of the user.
  • Name: res

    • Type: Object
    • Description: res is nothing but the response object which gets you the coupons code to the user.
  • Response:

    • Http Code: 200
    • Name: returnObj
    • Type: Object
    Name Type
    success boolean
    message string
    coupons array

Add Coupons Route By Admin

  1. API Path: api/Coupons/addCoupons
  2. Method: POST
  3. Description: This is a protected route in which you can add the coupons.
  4. Parameters:

    • Name: req
    • Type: Object
    Name In Type
    couponName req.body string
    discountAmount req.body number
    • Name: jwtAccessToken
    • In: Header
    • Type: String
    • Description: JWT access token is used to check the authenticity of the user.
  • Name: res

    • Type: Object
    • Description: res is nothing but the response object in which you get the save coupons.
  • Response:

    • Http Code: 200
    • Name: returnObj
    • Type: Object
    Name Type
    success boolean
    message string
    data object

Update Coupon Status Route For Admin

  1. API Path: api/Coupons/updateCoupon
  2. Method: PUT
    1. Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
  3. Parameters:

    • Name: req
    • Type: Object
    Name In Type
    id req.body string
    status req.body boolean
    • Name: jwtAccessToken
    • In: Header
    • Type: String
    • Description: JWT access token is used to check the authenticity of the user.
  • Name: res

    • Type: Object
    • Description: res is nothing but the response object which gets you the updated coupons details
  • Response:

    • Http Code: 200
    • Name: returnObj
    • Type: Object
    Name Type
    success boolean
    message string
    data object

Get All Coupons Route For Admin

  1. API Path: api/Coupons/getAllCoupons
  2. Method: GET
  3. Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
  4. Parameters:

    • Name: req
    • Type: Object

      Name In Type
      pageNo req.query number
    • Name: jwtAccessToken

    • In: Header
    • Type: String
    • Description: JWT access token is used to check the authenticity of the user.
  • Name: res

    • Type: Object
    • Description: res is nothing but the response object which gets you the all coupons details.
  • Response:

    • Http Code: 200
    • Name: returnObj
    • Type: Object
    Name Type
    success boolean
    message string
    data array

results matching ""

    No results matching ""