bookshelf application is a book data management system. This application is made to fulfill my submission task in dicoding. The application is made only on the backend side.
Hapi.js - Backend Framework
These instructions will get this project up and running on your local machine.
You will need to install Node.js and its package manager, NPM. You can also install nodemon to run scripts automatically (Optional)
git clone https://github.com/abilsabili50/Bookshelf-Api.git
cd Bookshelf-Api
npm install
if you have installed nodemon, use the following command :
npm run dev
if you don't have installed nodemon then use the following command :
npm run start
This route serves as the endpoint for adding book data.
- Method : POST
- Endpoint :
/books
- Header :
- Content-Type: application/json
- Accept: application/json
- Body :
{
"name": "string",
"year": "number",
"author": "string",
"summary": "string",
"publisher": "string",
"pageCount": "number",
"readPage": "number",
"reading": "boolean"
}
- Response :
{
"status": "success",
"message": "Buku berhasil ditambahkan",
"data": {
"bookId": "string"
}
}
This route serves as the endpoint for retrieving all book data.
- Method : GET
- Endpoint :
/books
- Header :
- Accept : application/json
- Response :
{
"status": "success",
"data": {
"books": [
{
"id": "string",
"name": "string",
"publisher": "string"
}
],
}
This route serves as the endpoint for retrieving book details.
- Method : GET
- Endpoint :
/books/:bookId
- Header :
- Accept : application/json
- Response :
{
"status": "success",
"data": {
"book": {
"id": "string",
"name": "string",
"year": "number",
"author": "string",
"summary": "string",
"publisher": "string",
"pageCount": "number",
"readPage": "number",
"reading": "boolean",
"finished": "boolean",
"insertedAt": "date",
"updatedAt": "date"
}
}
}
This route serves as the endpoint for updating book data.
- Method : PUT
- Endpoint :
/books/:bookId
- Header :
- Content-Type : application/json
- Accept : application/json
- Body :
{
"name": "string",
"year": "number",
"author": "string",
"summary": "string",
"publisher": "string",
"pageCount": "number",
"readPage": "number",
"reading": "boolean"
}
- Response :
{
"status": "success",
"message": "Buku berhasil diperbarui"
}
This route serves as the endpoint for deleting book data.
- Method : DELETE
- Endpoint :
/books/:bookId
- Header :
- Accept : application/json
- Response :
{
"status": "success",
"message": "Buku berhasil dihapus"
}
Click here to read more complete documentation of hapi framework