Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/adrianwilker/personal-library

Add or remove books from the list or comment about them.
https://github.com/adrianwilker/personal-library

chai freecodecamp javascript mocha qa quality-assurance

Last synced: 9 days ago
JSON representation

Add or remove books from the list or comment about them.

Awesome Lists containing this project

README

        

# Personal Library

This project was developed in the freeCodeCamp's Quality Assurance course.

To complete this project I had to implement the API with the GET, POST and DELETE methods. To do this, establish a connection with MongoDB, a NoSQL database. After that, I implemented and performed the necessary unit tests.

It's also available on replit: replit.com/@adrianwilker/personal-library.


Deploy: personal-library-xese.onrender.com

In this project were used:


  • Bootstrap

  • Chai

  • Express

  • JavaScript

  • Mocha

  • MongoDB

  • Mongoose

  • Node.js


Tests:



  • You can send a POST request to /api/books with title as part of the form data to add a book. The returned response will be an object with the title and a unique _id as keys. If title is not included in the request, the returned response should be the string missing required field title.

  • You can send a GET request to /api/books and receive a JSON response representing all the books. The JSON response will be an array of objects with each object (book) containing title, _id, and commentcount properties.

  • You can send a GET request to /api/books/{_id} to retrieve a single object of a book containing the properties title, _id, and a comments array (empty array if no comments present). If no book is found, return the string no book exists.

  • You can send a POST request containing comment as the form body data to /api/books/{_id} to add a comment to a book. The returned response will be the books object similar to GET /api/books/{_id} request in an earlier test. If comment is not included in the request, return the string missing required field comment. If no book is found, return the string no book exists.

  • You can send a DELETE request to /api/books/{_id} to delete a book from the collection. The returned response will be the string delete successful if successful. If no book is found, return the string no book exists.

  • You can send a DELETE request to /api/books to delete all books in the database. The returned response will be the string complete delete successful if successful.