Giter Club home page Giter Club logo

reviewsapi's Introduction

Reviews API

REST API that supports the customer reviews section of a product page in an e-commerce application.

Polyglot persistence was used and Review information is stored in both MySQL and MongoDB in different shapes. API supports all operations that a modern e-commerce application’s product page requires. Three entities are persisted:

  • product
  • review
  • comment

Each product can have many reviews added by the customers. Each review can have many comments.

The project shows:

  • connection between an application and database
  • use of Flyway with SQL scripts to create entity tables
  • Spring Data JPA repositories and data modeling
  • Spring Data Mongo repositories
  • tests of both type of repositories

Instructions

  1. clone the repository
  2. start mysql and mongodb
  3. api can be used using tools like Postman

Create a new Product (POST request)

/products/

Body:

{
	"name": "product",
	"description": "desc",
	"price": 10.50
}

Get a product by id (GET request)

/products/{id}

Get a product by name (GET request)

/products/name/{name}

Get all existing products (GET request)

/products/

Get a review for a product by product id (GET request)

/reviews/products/{product_id}

Add a new review for a product (POST request)

/reviews/products/{product_id}

Body:

{
	"rating": 5,
	"review_title": "Title",
	"review_text": "Long text"
}

Get comments for a review (GET request)

/comments/reviews/{review_id}

Add a new comment for a review (POST request)

/comments/reviews/{review_id}

Body:

{
	"comment_text": "the best comment ever"
}

To do (still in progress)

  1. The project uses its own JSON representation for REST instead of serializing the entities directly.
  2. The project uses aggregations to calculate average rating for the product.

reviewsapi's People

Contributors

lengyelluk avatar aravindanr avatar abrahamfeinberg avatar udacavs avatar abefeinberg avatar mvirgo avatar

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.