This is a Python port of my Node.js personal library microservice, built with Flask and SQLite. The front end API tests on the home page also use Bootstrap, jQuery, and highlight.js. The API fulfills the following user stories:
- I can post a
title
to/api/books
to add a book and returned will be the object with thetitle
and a unique_id
. - I can get
/api/books
to retrieve an aray of all books containingtitle
,_id
, &commentcount
. - I can get
/api/books/{_id}
to retrieve a single object of a book containingtitle
,_id
, & an array ofcomments
(empty array if no comments present). - I can post a
comment
to/api/books/{_id}
to add a comment to a book and returned will be the books object similar to get/api/books/{_id}
. - I can delete
/api/books/{_id}
to delete a book from the collection. Returned will be"delete successful"
if successful. - If I try to request a book that doesn't exist I will get a
"no book exists"
message. - I can send a delete request to
/api/books
to delete all books in the database. Returned will be"complete delete successful"
if successful.