GithubHelp home page GithubHelp logo

sathyesh / simple-library-tdd Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 699 KB

This is a simple library management project which allows users to borrow and return the books. This project is developed using Vue.js, Express JS and TDD approach.

Shell 0.01% JavaScript 16.24% HTML 73.29% CSS 3.15% Vue 4.33% SCSS 2.98%
library-management vuejs2 vuex microservices-architecture expressjs

simple-library-tdd's Introduction

Simple Library Application

Backend

Built With

Express.js Node.js Mongoose Mocha

Architectural Assumptions

  • Created the REST API service using microservice architecture approach
  • User and Books CRUD operations is supported
  • Each user's books borrowed list is saved in the User object
  • Number of available copies is maintained in the Book object. if the available copy is 0, hence the book is not available
  • Borrowing and return history of Users and Books is not supported
  • User Authentication, registration and oAuth is not supported
  • 80% of the code is developed with TDD

Development Docs

  • Read the further instructions in README.md for running and testing the application using development server

Unit Test

"unit_test.png"

Code Coverage

"code_coverage.png"

End Points

  • Versioning is supported and maintained using config.js

Homepage

  • Request : GET /
  • Response :
      {
       "message": "Library REST API Server is running"
      }
    

User Creation

  • Request : POST /v1/api/users/

     {
      "name": "test1", 
      "email": "[email protected]",
      "password": "dsjhdhdscdsmndsjhsdjd", 
      "books_borrowed": []
    }
    
  • Response :

     {
      "books_borrowed": [],
      "_id": "5f45894e0120bf5ac299ac52",
      "name": "test",
      "email": "[email protected]",
      "password": "dsjhdhdscdsmndsjhsdjd",
      "__v": 0
    }
    

Getting User Information

  • Request : GET /v1/api/users/5f45894e0120bf5ac299ac52

  • Response :

     {
      "books_borrowed": [],
      "_id": "5f45894e0120bf5ac299ac52",
      "name": "test",
      "email": "[email protected]",
      "password": "dsjhdhdscdsmndsjhsdjd",
      "__v": 0
    }
    

Updating User Information

  • Request : PUT /v1/api/users/5f45894e0120bf5ac299ac52
  {
   "name": "test1", 
   "email": "[email protected]",
   "password": "dsjhdhdscdsmndsjhsdjd", 
   "books_borrowed": []
  }
  • Response :

     {
      "books_borrowed": [],
      "_id": "5f45894e0120bf5ac299ac52",
      "name": "test1",
      "email": "[email protected]",
      "password": "dsjhdhdscdsmndsjhsdjd",
      "__v": 0
     }
    

Deleting User Information

  • Request : DELETE /v1/api/users/5f45894e0120bf5ac299ac52

  • Response :

      {
       "message": "User deleted"
      }
    

Book Creation

  • Request : POST /v1/api/books/

     {
      "isbn": "ISBN001", 
      "title": "Book1",
      "available_copies": 1
     }
    
  • Response :

     {
      "available_copies": 1,
      "_id": "5f458f080120bf5ac299ac56",
      "isbn": "ISBN001",
      "title": "Book1",
      "__v": 0
     }
    

Getting Book Information

  • Request : GET /v1/api/books/ISBN001

  • Response :

     {
      "available_copies": 1,
      "_id": "5f4588c2f57c045a88ad8543",
      "isbn": "ISBN001",
      "title": "Book1",
      "__v": 0
     }
    

Updating Book Information

  • Request : PUT /v1/api/books/ISBN001
  {
   "isbn": "ISBN001", 
   "title": "New Book1",
   "available_copies": 4
  }
  • Response :

     {
      "available_copies": 4,
      "_id": "5f4588c2f57c045a88ad8543",
      "isbn": "ISBN001",
      "title": "New Book1",
      "__v": 0
    }
    

Deleting Book Information

  • Request : DELETE /v1/api/books/ISBN001

  • Response :

      {
       "message": "Book deleted"
      }
    

Frontend

Built With

Vue.js Node.js Mocha

Development Assumptions and Issues

  • At first, thought of hosting the backend in AWS, because of limited time, I could not able to do that
  • Currently used local json for user stories development
  • Followed the same Data model as MongoDB
  • All the user stories are implemented
  • For quick running, please follow Local Hosting Procedure
  • only 40% of the code is developed with TDD

Local Hosting Procedure

There are two ways available for the local hosting procedure.

Before doing local hosting, unzip the file and navigate to folder(simple-library-tdd) through terminal

cd simple-library-tdd

Host using serve server

  • Production-ready application files are available in frontend/production-ready-app-files under dist folder
  • Navigate there using following command
    cd frontend/production-ready-app-files
  • Install serve using the following command
    npm install
  • Run below command in the terminal and wait for the server to start
    npm run production-ready
  • Application is available in http://localhost:8080

Host using framework development server

  • Read the further instructions in README.md for running the application using development server

Source Code

  • Source code files are available under src folder

Unit Test

  • Unit test cases are available under tests folder

Screenshot

"code_coverage.png"

simple-library-tdd's People

Contributors

sathyesh avatar

Stargazers

 avatar

Watchers

 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.