- 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
- Read the further instructions in README.md for running and testing the application using development server
- Versioning is supported and maintained using config.js
- Request :
GET /
- Response :
{ "message": "Library REST API Server is running" }
-
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 }
-
Request :
GET /v1/api/users/5f45894e0120bf5ac299ac52
-
Response :
{ "books_borrowed": [], "_id": "5f45894e0120bf5ac299ac52", "name": "test", "email": "[email protected]", "password": "dsjhdhdscdsmndsjhsdjd", "__v": 0 }
- 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 }
-
Request :
DELETE /v1/api/users/5f45894e0120bf5ac299ac52
-
Response :
{ "message": "User deleted" }
-
Request :
POST /v1/api/books/
{ "isbn": "ISBN001", "title": "Book1", "available_copies": 1 }
-
Response :
{ "available_copies": 1, "_id": "5f458f080120bf5ac299ac56", "isbn": "ISBN001", "title": "Book1", "__v": 0 }
-
Request :
GET /v1/api/books/ISBN001
-
Response :
{ "available_copies": 1, "_id": "5f4588c2f57c045a88ad8543", "isbn": "ISBN001", "title": "Book1", "__v": 0 }
- 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 }
-
Request :
DELETE /v1/api/books/ISBN001
-
Response :
{ "message": "Book deleted" }
- 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
There are two ways available for the local hosting procedure.
- Host using serve (https://github.com/vercel/serve) server for production-ready files
- Host using framework development server for source codes
Before doing local hosting, unzip the file and navigate to folder(simple-library-tdd) through terminal
cd simple-library-tdd
- 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
- Read the further instructions in README.md for running the application using development server
- Source code files are available under src folder
- Unit test cases are available under tests folder