This RESTful book API allows users to perform CRUD (Create, Read, Update, Delete) operations on books. The API follows RESTful principles and uses the HTTP methods (GET, POST, PUT, DELETE) for each operation.
Returns a JSON string of books (option for all books, and a single book by using the id). No authentication required.
GET /books
GET /books/{id}
POST /add-book
{
"title": "Steve Jobs by Waater Isaacson: The Exclusive Biography",
"description": "Walter Isaacson tells the story of the rollercoaster life and searingly intense personality of creative entrepreneur whose passion for perfection and ferocious drive revolutionized six industries: personal computers, animated movies,music, phones, tablet computing, and digital publishing.",
"author": "Walter Isaacson",
"price": 9
}
PUT /books/{id}
{
"title": "The Little Prince",
"author": "Antoine de Saint-Exupéry",
"description": "The story follows a young prince who visits various planets, including Earth, and addresses themes of loneliness, friendship, love, and loss.",
"price": 8
}
DELETE /books/{id}
PHP 7.4.26 Laravel Framework 8.83.27
Process of getting the API up and running:
Make a file called .env
. copy over the env.example in there, and add in your database values.
- Install composer using the following command:
composer install
. - Then update the compsoser from your composer.json file by running the command:
Composer update composer dump-autoload
- To get the migrations run the command:
php artisan migrate
- Now finally run the command:
php artisan serve