ITI Nodejs Course Project, Book Reviews API that allows API consumer to register, login, then he can use private API that allows him to:
- add a book to the system.
- rate a book(five stars system).
- write a comment on a book.
- favor a book [1=reading, 2=currently reading, 3=read].
- list books he created.
- list books he favored.
- list books he rated.
- list books he wrote a comment on it. also, there is a public API that allows consumers to:
- list all books in the system
- access specific book with its id.
- access specific book with its full details.
NodeJs – Express – mongoose - mongodb
suppose that our API URL is http://localhost:3000, it is possible to make one of the following requests on the api:
Post Request On http://localhost:3000/user/register With Body
{
"userName": "moamen soroor",
"password": "1234",
"email": "moamensoroor@gmail.com"
}
Post Request On http://localhost:3000/user/login With Body
{
"password": "1234",
"email": "moamensoroor@gmail.com"
}
NOTE: token will be returned and API Comsumer must send it to the API each time he make a request NOTE: token will be removed after 10 minutes - for testing purposes and you can increase the time - , and user must login again.
Post Request On http://localhost:3000/user/logout
Post Request On http://localhost:3000/user/logoutall
Post Request On http://localhost:3000/user/books/ With Body
{
"ISBN": "100",
"title": "you don't know js",
"description": "It’s easy to learn parts of JavaScript,",
"publishData": "1995-01-22",
"authors": [
"kyle Simpson"
],
"categories": [
"programming",
"computer science"
]
}
Put Request On http://localhost:3000/user/books/rating With Body
{
"bookId": "book id here",
"rating": 1
}
Please Note: rating is between [0, 0.5, 1, 1.5, 2.5, 3, 3.5, 4, 4.5, 5]
Put Request On http://localhost:3000/user/books/fav With Body
{
"bookId": "book id here",
"status": 1
}
Please Note: status is between [1,2,3] which means [1=reading, 2=currently reading, 3=read]
Put Request On http://localhost:3000/user/books/review With Body
{
"bookId": "book id here",
"review": "your comment goes here."
}
Please Note: you can write any string in review like social media comments
Get Request On http://localhost:3000/user/books/rating
Get Request On http://localhost:3000/user/books/fav
Get Request On http://localhost:3000/user/books/review
Get Request On http://localhost:3000/api/books/
Get Request On http://localhost:3000/api/books/
{
"bookId": "book id here"
}
Get Request On http://localhost:3000/api/books/details
{
"bookId": "book id here"
}