Skip to content

MusketeerHD/Bookshelf-API-Dicoding-Back-End

Repository files navigation

Welcome to Bookshelf API Dicoding Back-End 👋

Version Documentation License: MIT License Twitter: MusketeerHD

This is a project submission for the "Belajar Membuat Aplikasi Back-End untuk Pemula" course on Dicoding which consists of building a RESTful API namely bookshelf API using the Hapi framework, Nodemon for automatic server restarting, and Postman for testing and also eslint.

Demo

Features :

  • Displays a list of books
  • View book details
  • Add a new book
  • Change book data
  • Delete books

Prerequisites and Technology

Install

Clone this repo and install npm :

npm install

Initialize

If you dont have or wanna change the "node_modules" use :

npm init --y

Hapi & Nodemon Installation

npm install @Hapi/hapi
npm install nodemon

if you haven't installed eslint, then you have to install it :

npm install --save-dev eslint

All manual install instruction is in here

Run & Usages

npm run start

Access the API endpoints

Access in Bookshelf API Test Collection & Environment using Postman or any other REST client at http://localhost:9000

API Endpoints

  • GET /books = Get all books in the bookshelf
  • GET /books/{bookId} = Get a book by its bookId
  • POST /books = Add a new book to the bookshelf
  • PUT /books/{bookId} = Update a book by its bookId
  • DELETE /books/{bookId} = Delete a book by its bookId

Response Format

All API endpoints will respond with JSON data in the following format:

  "status": "success",
  "message": "Success message",
  "data": {
    // Response data
  }
}

If an error occurs, the response format will be:

  "status": "fail",
  "message": "Error message"
}

Author

👤 Musketeer

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2023 Musketeer.
This project is MIT licensed.