Skip to content

Instantly share code, notes, and snippets.

@crazywolf132
Last active July 2, 2019 01:43
Show Gist options
  • Save crazywolf132/f508a094a9a8d054202dadb0d55adab9 to your computer and use it in GitHub Desktop.
Save crazywolf132/f508a094a9a8d054202dadb0d55adab9 to your computer and use it in GitHub Desktop.
Simple case study for micro-services

TASK

Create a Library.

A simple java application will be used to test this, so please use the end-points provided.

Everything should be done in rest, and a simple database will be setup with some basic info for testing.

Services

Library - Core service for handling everything.

Book - Holds book id.
BookInfo - Holds book title, description.

Price - Holds price of the book
Status - Holds status (bought OR loaned OR none)

Library

 - /API/All
    Returns all of the books, with their information and including price, and status.
 
 - /API/Book/{id}
    Returns all the information on a selected book.

 - /API/Price/{id}
    Returns the price of a specific book.

 - /API/Info/{id}
    Returns the info of a specific book.

 - /API/Status/{id}
    Retuns the status of a specific book.
    
 - /API/All/Loaned
    Returns all the books on loan.
    
 - /API/All/Bought
    Returns all the bought books.

Book

GET Requests

 - /API/All
    Returns all the books we know of.

POST Requests

 - /API/Add
    Adds a book (takes no information)

BookInfo

GET Requests

 - /API/All
    Returns all books and their Name and Description.

 - /API/Book/{id}
    Returns the information of a specific book.

POST Requests

 - /API/Add
    Adds a new book info. (Takes name and description)

Price

GET Requests

 - /API/All
    Returns all prices of all books.

 - /API/Price/{id}
    Returns the price of a specific book.

POST Requests

 - /API/Add
    Adds a new price. (Takes price)

Status

GET Requests

 - /API/All
    Returns all the statuses of all the books.

 - /API/Book/{id}
    Returns the status of a specific book.

POST Requests

 - /API/Add
    Adds new status (Takes status as input)

Requirements.

All must use their own table in a database. The Library service must not use any databases...

None of them should communicate with eachother.

Data.

This is what the data should look like for each Book.

{
        "id" : 1,
        "title" : "The Communist Manifesto",
        "description": "The Communist Manifesto (1848), Marx and Engels's revolutionary summons to the working classes, is one of the most important and influential political polemics ever written.",
        "status": "none",
        "price": 12.95
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment