Giter Club home page Giter Club logo

sample-products-service's Introduction

Sample Products Service

Overview

This is a sample multi module maven project which conatins a set of Restful API operations on Product. The project caters a variety of CRUD operations on product/product options.

Project Structure

This is a multi module maven project. This project is compiled in Java 8 with Spring Boot following microservice pattern. The Project has three modules:

  • The micoservice module produces a spring boot application.
  • The functional-tests is used to run functional tests using the karate library.
  • The docker module is used to package the microservice artefact into a docker image and push it onto a docker registry.

Compile & Test

Basic Prerequisite :

  1. Maven Setup
  2. Open JDK 8 or Oracle Java 8

Running in local:

  • Once you have the above Prerequisites, compile the project code and run the below command. This would run the entire build for all modules and execute tests with creating artefacts.

    mvn clean install

  • You could also run only the application by using below command :

    mvn spring-boot:run

The project also uses JaCoCo which is a free code coverage library for Java. Once the tests are executed(using mvn clean install) the code coverage report is generated in below locations.

  • Jacoco data file location - functional-tests/target/jacoco-merged.exec

  • Jacoco Coverage Report location - functional-tests/target/jacoco-report/index.html

Code Style

The Project uses Google Java Code Style.

Swagger docs location

API Enpoints

  1. GET /products - Gets all products.
  2. GET /products?name={name} - Finds all products matching the specified name.
  3. GET /products/{id} - Gets the project that matches the specified ID - ID is a UUID.
  4. POST /products - Creates a new product.
  5. PUT /products/{id} - Updates a product.
  6. DELETE /products/{id} - Deletes a product and its options.
  7. GET /products/{id}/options - Finds all options for a specified product.
  8. GET /products/{id}/options/{optionId} - Finds the specified product option for the specified product - optionId is a UUID.
  9. POST /products/{id}/options - Adds a new product option to the specified product.
  10. PUT /products/{id}/options/{optionId} - Updates the specified product option.
  11. DELETE /products/{id}/options/{optionId} - Deletes the specified product option.

Docker Build

To create a docker image from this artefact add the pom profile build-docker-image and a docker image will get created in your registry. Command as follows :

mvn clean install -P build-docker-image

Coverage Report

Merged Coverage Report

sample-products-service's People

Contributors

praveengnair avatar

Watchers

 avatar  avatar

Forkers

raghulsivaraj

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.