Skip to content

GonzalezEstevan/Reviews-API

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reviews-API

Overview

Reviews API that holds millions of data entries designed to quickly retrieve information for an e-commerce front-end. Tested with K6, loaderIO, and optimized with an Nginx load balancer.

#Built by

  • Estevan Gonzalez

  • Optimized web performance using

    • Indexing
    • Caching
    • Horizontally scaling
    • Nginx Load Balancer
  • Testing:

    • k6
    • loaderIO

Features

Testing

  • Testing Locally ScreenShot

  • Testing EC2 w/LoaderIO ScreenShot

Installation

  1. Git Fork and Clone this repo
  2. Open up a new terminal and run the following command to install dependencies:
npm install
  1. Create a copy of .envCopy replace name to .env
  2. Replace empty string with youre correct database personal information

Setup

  1. In separate terminals, run the following commands to start server and build webpack bundle
npm run start
  1. In your browser, go to API:
http://localhost:3000

Overview Of Data Shape

  • Reviews Endpoint Get /reviews Returns a list of reviews for a particular product

    Parameters

    Parameter Type Description
    page integer Selects the page of results to return. Default 1.
    count integer Specifies how many results per page to return. Default 5.
    sort text Changes the sort order of reviews to be based on
    "newest", "helpful", or "relevant"
    product_id integer Specifies the product for which to retrieve reviews.
    {
    "product": "2",
    "page": 0,
    "count": 5,
    "results": [
    {
      "review_id": 5,
      "rating": 3,
      "summary": "I'm enjoying wearing these shades",
      "recommend": false,
      "response": null,
      "body": "Comfortable and practical.",
      "date": "2019-04-14T00:00:00.000Z",
      "reviewer_name": "shortandsweeet",
      "helpfulness": 5,
      "photos": [{
          "id": 1,
          "url": "urlplaceholder/review_5_photo_number_1.jpg"
        },
        {
          "id": 2,
          "url": "urlplaceholder/review_5_photo_number_2.jpg"
        },
        // ...
      ]
    },
    • Meta Data Get /reviews/meta Returns review metadata for a given product.

    Parameters

    Parameter Type Description
    product_id integer Required ID of the product for which data should be
    returned
    {
      "product_id": "2",
      "ratings": {
        2: 1,
        3: 1,
        4: 2,
        // ...
      },
      "recommended": {
        0: 5
        // ...
      },
      "characteristics": {
        "Size": {
          "id": 14,
          "value": "4.0000"
        },
        "Width": {
          "id": 15,
          "value": "3.5000"
        },
        "Comfort": {
          "id": 16,
          "value": "4.0000"
        },
        // ...
    }
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%