Code Monkey home page Code Monkey logo

my-books's Introduction

my-books

Table of Contents

  1. Overview
  2. Technologies
  3. Getting Started
  4. Building
  5. REST APIs
  6. User
  7. Book
  8. Author

Description

A Book Store server side project in purpose of providing APIs that are used to CRUD books and their authors.

Tech stack

  • Java 11
  • Spring Boot
  • AWS Dynamo DB
  • AWS Cognito
  • OAuth2
  • JWT
  • JUnit5
  • Mockito
  • Lombok
  • MapStruct
  • Swagger
  • Microservices (implemented on a feature branch)

Getting Started

Create the particular tables on AWS DynamoDB and make sure to provide your AWS credentials in order to run successfully the app.

You can rely on model infrastracture where these tables are created by AWS CDK JAVA. All APIs are defined on model api .

You have to authorize firstly to get access token & refresh token, then use refresh token to gain a new access token if it expires. Books and authors APIs are exposed by access token, otherwise you will get 401 Unauthorized.

Build

From the root folder, just execute the following command which will build/run unit and integration tests.

./gradlew clean build

REST APIs

User

  1. Login user POST /user/login

    Request body

     {
       "email": "[email protected]",
       "password": "user@123"
     }

    Response 200

    {
      "accessToken": "{access_token}",
      "refreshToken": "{refreshToken}"
    }
  2. Signup new user POST /user/signup

    Request body

     {
       "email": "[email protected]",
       "password": "user@123"
     }

    Response 201

  3. Refresh access token GET /user/refresh-token

    Response 200

    {
      "accessToken": "{access_token}",
      "refreshToken": "{refreshToken}"
    }

Book

  1. Get book by id GET /book/{id}

    Response 200

    {
      "id": "d18784b8-a7f3-4d45-b45c-2688e643b9f2",
      "title": "Goals",
      "authorId": "112bf093-a47e-4d09-a2a8-02c20ef5e2f7"
    }
  2. Add new book POST /book

    Request body

     {
       "title": "Sky is not far",
       "authorId": "112bf093-a47e-4d09-a2a8-02c20ef5e2f7"
     }

    Response 201

    {
      "id": "931e3c25-de9d-4a88-b955-021bcd3c1616"
    }
  3. Update a book PUT /book/{id}

    Response 200

    {
      "id": "d18784b8-a7f3-4d45-b45c-2688e643b9f2",
      "title": "My Goals",
      "authorId": "112bf093-a47e-4d09-a2a8-02c20ef5e2f7"
    }
  4. Delete a book DELETE /book/{id}

    Response 204

Author

  1. Get author by id GET /author/{id}

    Response 200

    {
      "id": "112bf093-a47e-4d09-a2a8-02c20ef5e2f7",
      "firstName": "Foo",
      "lastName": "Bar"
    }
  2. Add new author POST /author

    Request body

     {
       "firstName": "Json",
       "lastName": "Jakarta"
     }

    Response 201

    {
      "id": "81f4ee81-9e40-4a8d-a0c7-0d9df3e6ee2a"
    }
  3. Update an author PUT /author/{id}

    Response 200

    {
      "id": "81f4ee81-9e40-4a8d-a0c7-0d9df3e6ee2a",
      "firstName": "Json",
      "lastName": "Bar"
    }
  4. Delete an author DELETE /book/{id}

    Response 204

my-books's People

Contributors

menabebawy avatar menabebawyebcont 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.