Giter Club home page Giter Club logo

design-rating-system's Introduction

Rating APP Service

A simple service for getting all unrated products for a user. He/she can rate a product that has already been purchased and delivered. APIs to get the average rating of the products and user rating for each and every product.

Requirements

  • npm
  • node >= v12.14.0 (will likely work with older versions, but has never been tested)

Installation

npm install

Running

npm start will start the application at http://localhost:8080 (set environment variable PORT to change the port).

The service can now be called:

$ curl http://localhost:8080/ratings/products -- This will give us the products list that are avaiable in inventory
{"1":{"name":"Apple Mac Pro","description":"Apple laptop Macbook pro 15Inch touch Bar","average_rating":3.6},"2":{"name":"Apple Mac Air","description":"Apple laptop Macbook Air 13Inch","average_rating":0},"3":{"name":"Apple Home","description":"Apple Home with 1TB SDD","average_rating":0}}

$ curl http://localhost:8080/ratings/true -H "user_id:1" -- This will get all products that are already rated by user_id:1
[{"user_id":1,"product_id":1,"rating":3,"name":"Apple Mac Pro","description":"Apple laptop Macbook pro 15Inch touch Bar","average_rating":3.6}]

$ curl http://localhost:8080/ratings/false -H "user_id:1" -- This will get all products that are delivered but not rated by user_id:1
[{"user_id":1,"product_id":2,"rating":0,"name":"Apple Mac Air","description":"Apple laptop Macbook Air 13Inch","average_rating":0},{"user_id":1,"product_id":3,"rating":0,"name":"Apple Home","description":"Apple Home with 1TB SDD","average_rating":0}]%

Testing

Tests can be run with npm test.

All tests are colocated with their respective source files in *.spec.js files, using Jest with default settings.

You do not need to run the application separately to run any tests.

design-rating-system's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.