In this repo I show you how I made a little and basic book API with authentication and authorization system using JWT . This API provide you books and allows you to make CRUD actions according to the REST structure. So you can create,display,update and delete if you are authenticated! After creating account you receive token in the response header that you can use after to access routes that require to be logged
I use a mongoDB database with the npm package named Mongoose
I need to store users ,authors and courses
- usersCollection
- password
- booksCollection
- name
- author
- year
- description
Verb | Url | Actions |
---|---|---|
GET | /book | Display all books |
POST | /new | Create new book |
GET | /book/bookID | Display a specific book |
PUT | book/bookID | Update a specific book |
DELETE | book/bookID | Delete a specific book |
POST | /register | Create new user |
POST | login | Login route |