Demo app with basic REST API and using MongoDB as Database.
Route | HTTP | Description |
---|---|---|
/api/books |
GET | Get all the books info(admin only) |
/api/books/:id |
GET | Get a book data info by its ID (admin and/or authenticated user) |
/api/books |
POST | Create a new books document (admin only) |
/api/books/:id |
DELETE | Delete a books data (admin only) |
/api/books/:id |
PUT | Update a books with new info (admin and/or authenticated user) |
Route | HTTP | Description |
---|---|---|
/api/customers |
GET | Get all the books info(admin only) |
/api/customers/:id |
GET | Get a book data info by its ID (admin and/or authenticated user) |
/api/customers |
POST | Create a new books document (admin only) |
/api/customers/:id |
DELETE | Delete a books data (admin only) |
/api/customers/:id |
PUT | Update a books with new info (admin and/or authenticated user) |
With only npm:
npm init
npm install express-generator --save
npm install
npm install mongodb --save
npm install mongoose --save
Access the website via http://localhost:3000
or API via http://localhost:3000/api