API to integrate for a bookshelf management system
Type npm install
on the terminal to install all the node dependencies
After that, type npm run dev
to start the node development server.
It is a book management system. Where users can authenticate. After signing in, users can add, edit, delete book info. Book list and details can be seen publicly.
- Signup
- Login
- Add book
- Edit book
- Delete book
- Get book list
- Get book details
To signup a new user send a POST
request to the route /users/signup
with the data as following JSON format:
{
"name": "name",
"email": "email",
"password": "password",
"mobile": "mobile"
}
The mobile
field is optional here.
To login an existing user, send a POST
request to route /users/login
with the data as following JSON format:
{
"email": "email",
"password": "password"
}
For SIGNUP
and LOGIN
, both cases an authentication token
is given to user, to authenticate a user for some operations.
A logged in user can update his information. To update send a PATCH
request to route /users
with the necessary data to update as JSON format (same JSON format as SIGNUP
request). The data can contain the following properties:
- name
- password
- mobile
To view the list of registered user, send a GET
request to the route /users
. It will return the public profile information of the users.
To view the list of books of a user, send a GET
request to the route /users/books
. It will response with a book list of the logged in user.
To fetch the full list of books, send a GET
request to the route /books
. It will response with the full book list.
User can also pass some sorting queries to the
URL
to performsorting
on response data. In that case, send aGET
request to the route/books/?sortBy=<key>:<type>
. Replace the<key>
with theproperty name
, on which the search will execute based on. Also, replace<type>
either withasc
ordesc
keyword.asc
is for assending sort anddesc
is for descending.
To fetch a specific book details, send a GET
request to the route /books/:id
. Here replace :id
with the ObjectID
of that specific book user want to fetch.
An existing user can add a new book into the collection. While logged in, send a POST
request to the route /books
with the data as following JSON format:
{
"name": "book name",
"author": "author",
"publication": "publication",
"year": "year of publication"
}
The year
field is optional here.
A logged in user can update any of his book information. To update, send a PATCH
request to route /books/:id
with the necessary data to update as JSON format (same JSON format as Add new book
request). The data can contain the following properties:
- name
- author
- publication
- year
A logged in user can delete any of his book. While logged in, send a DELETE
request to the route /books/:id
, where :id
is the ObjectID
of that specific book user wants to delete. User will get the deleted book information in response.