Skip to content

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.

Notifications You must be signed in to change notification settings

sathyesh/simple-library-tdd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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": "test1@gmail.com",
      "password": "dsjhdhdscdsmndsjhsdjd", 
      "books_borrowed": []
    }
    
  • Response :

     {
      "books_borrowed": [],
      "_id": "5f45894e0120bf5ac299ac52",
      "name": "test",
      "email": "test@gmail.com",
      "password": "dsjhdhdscdsmndsjhsdjd",
      "__v": 0
    }
    

Getting User Information

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

  • Response :

     {
      "books_borrowed": [],
      "_id": "5f45894e0120bf5ac299ac52",
      "name": "test",
      "email": "test@gmail.com",
      "password": "dsjhdhdscdsmndsjhsdjd",
      "__v": 0
    }
    

Updating User Information

  • Request : PUT /v1/api/users/5f45894e0120bf5ac299ac52
  {
   "name": "test1", 
   "email": "test12@gmail.com",
   "password": "dsjhdhdscdsmndsjhsdjd", 
   "books_borrowed": []
  }
  • Response :

     {
      "books_borrowed": [],
      "_id": "5f45894e0120bf5ac299ac52",
      "name": "test1",
      "email": "test12@gmail.com",
      "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"

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published