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
- Node
- Npm - Package Manager
- ESList - Find code problems and fix syntax
- Nodemon - (Dev dependencie) Monitor file changes
- Express - Server framework
- MongoDB - Database
- Mongoose - Database Object modeling
- Mocha - Testing
- Sinon - Testing
- Should - Testing
- Supertest - Integration testing
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.
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
This project has unit and integration tests.
Run tests with npm test
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 |