A website aimed at sharing books and democratizing reading.
This project is divided into two repositories, the back-end, the one you're looking at, and the front-end, which can be accessed by clicking on the link: front-end-bookadinho.
OBS:
- The application is for academic and disciplinary purposes, so there will be constant changes to the structure, coding and dependencies of the project.
- It's in mock-up form, i.e. it doesn't have a database yet.
- Any user or book registration is not permanent.
- Node.js
- Express.js
- TypeScript
- JSONWebToken
The routes are /books and /profiles, both of which have create, query, update and delete (CRUD) routes.
- In order to query, update or delete a profile or book, you must have a token.
- This token is returned when the user and password have been validated.
Value | Required | Note | Data type |
---|---|---|---|
user_name | Yes | Informed on the body | String |
password | Yes | Informed on the body | String |
curl --request POST \
--url https://bookadinho-api.onrender.com/profile/authorization \
--header 'Content-Type: application/json' \
--data '{
"user_name": "<user_name>",
"password": "<password>"
}'
- It will return all the registered profiles.
Value | Required | Note | Data type |
---|---|---|---|
Token | Yes | Informed in the header | String |
curl --request GET \
--url https://bookadinho-api.onrender.com/profiles \
--header 'Authorization: <token>'
- It will return the profile registered with the id entered.
Value | Required | Note | Data type |
---|---|---|---|
Id | Yes | Informed on the route | Number |
Token | Yes | Informed in the header | String |
curl --request GET \
--url https://bookadinho-api.onrender.com/profile/:id \
--header 'Authorization: <token>'
- It will create a new profile.
Value | Required | Note | Data type |
---|---|---|---|
user_name | Yes | Informed on the body | String |
name | Yes | Informed on the body | String |
password | Yes | Informed on the body | String |
Yes | Informed on the body | String | |
description | No | Informed on the body | String |
likes | No | Informed on the body | Array['Like1', 'Like2', ...] |
latest_readings | No | Informed on the body | Array['Like1', 'Like2', ...] |
photo | No | Informed on the body | String |
curl --request POST \
--url https://bookadinho-api.onrender.com/profile \
--header 'Content-Type: application/json' \
--data '{
"user_name": "<user_name>",
"name": "<name>",
"password": "<password>",
"email": "<email>"
}'
- It will update some information in the logged-in profile.
Value | Required | Note | Data type |
---|---|---|---|
Token | Yes | Informed in the header | String |
User_name | Yes | Informed on the body | String |
Name | Yes | Informed on the body | String |
Password | Yes | Informed on the body | String |
Yes | Informed on the body | String | |
Description | No | Informed on the body | String |
Likes | No | Informed on the body | Array['Like1', 'Like2', ...] |
Latest_readings | No | Informed on the body | Array['Like1', 'Like2', ...] |
Photo | No | Informed on the body | String |
curl --request PUT \
--url https://bookadinho-api.onrender.com/profile \
--header 'Authorization: <token>' \
--header 'Content-Type: application/json' \
--data '{
"user_name": "<user_name>",
"name": "<name>",
"password": "<password>",
"email": "<email>"
}'
- Will delete the logged-in user's profile.
Value | Required | Note | Data type |
---|---|---|---|
Token | Yes | Informed in the header | String |
curl --request DELETE \
--url https://bookadinho-api.onrender.com/profile \
--header 'Authorization: <toke>'
- It will update the password of the logged-in user.
Value | Required | Note | Data type |
---|---|---|---|
Token | Yes | Informed in the header | String |
Password | Yes | Informed on the body | String |
curl --request PUT \
--url https://bookadinho-api.onrender.com/profile/password \
--header 'Authorization: <token>' \
--header 'Content-Type: application/json' \
--data '{
"password": "<password>"
}'
- It will return all the books registered.
curl --request GET \
--url https://bookadinho-api.onrender.com/books
- It will return the book registered with the id entered.
Value | Required | Note | Data type |
---|---|---|---|
Id | Yes | Informed on the route | Number |
curl --request GET \
--url https://bookadinho-api.onrender.com/book/:id
- It will create a new book.
Value | Required | Note | Data type |
---|---|---|---|
Token | Yes | Informed in the header | String |
Title | Yes | Informed on the body | String |
Author | Yes | Informed on the body | String |
Description | Yes | Informed on the body | String |
Is_read | Yes | Informed on the body | Boolean |
Photo | No | Informed on the body | String |
curl --request POST \
--url https://bookadinho-api.onrender.com/book \
--header 'Authorization: <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "<name>",
"author": "<author>",
"description": "<description>",
"photo": "<photo>",
"is_read": <is_read>
}'
- It will update the book's reading status.
Value | Required | Note | Data type |
---|---|---|---|
Token | Yes | Informed in the header | String |
Id | Yes | Informed on the route | Number |
curl --request PATCH \
--url https://bookadinho-api.onrender.com/book/read/:id \
--header 'Authorization: <token>' \
- It will update the book's exchange status.
Value | Required | Note | Data type |
---|---|---|---|
Token | Yes | Informed in the header | String |
Id | Yes | Informed on the route | Number |
curl --request PATCH \
--url https://bookadinho-api.onrender.com/book/read/:id \
--header 'Authorization: <token>' \
- It will delete the book with the id entered.
Value | Required | Note | Data type |
---|---|---|---|
Token | Yes | Informed in the header | String |
Id | Yes | Informed on the route | Number |
curl --request DELETE \
--url https://bookadinho-api.onrender.com/book/:id \
--header 'Authorization: <token>' \
"Work around we accept, what we don't accept is defeat" - My clan