/books-api

A small API of books using Express. Implementing almost all REST Verbs, contains Unit and Integration tests with mocha and uses Hypermedia for self documenting API.

Primary LanguageJavaScript

Express

This is a small API of books. Implementing almost all REST Verbs, contains Unit and Integration testing with mocha and uses Hypermedia for self documenting API.

What was used   |    Importing data   |    Installation   |    Tests   |    Routes

💡 What was used

📘 Importing data

Import Book data into your mongoDB database.

Make sure MongoDB is running with the command mongod then run mongo bookAPI < booksJson.js from the command line.

🏁 Installation

First of all, make sure that you have Node.js installed on your machine. Choose a package manager (NPM or Yarn)

Now, to install the dependencies

    npm install

To start the application

    npm start

🔧 Tests

This project has unit and integration tests.

Run tests with npm test

📨 Routes

Paths HTTP Method Description
/api/books GET Show All books
/api/books POST Create a new book
/api/books?genre=Fantasy GET Filter books of a genre, "Fantasy" in this case
/api/books/:id GET Get book with id
/api/books/:id PUT Edit all informations of a book
/api/books/:id PATCH Edit book
/api/books/:id DELETE Delete book