Giter VIP home page Giter VIP logo

books-api's Introduction

Book API

This book API calls an external API service which is the Ice And Fire API to get information about books and also implements its own database and has basic CRUD functions. It also includes the feature tests

Getting Started

Requirements

  • PHP 8.1 and above
  • MySQL
  • Composer

Clone the Repository on target machine:

git clone https://github.com/kayxleem/books-api.git
cd books-api

Set up your .env

DB_DATABASE=laravel (Replace with yours)
DB_USERNAME=root (Replace with yours)
DB_PASSWORD= (Replace with yours)

generate your laravel key

php artisan key:generate

Install dependencies (if you have composer locally):

composer install

or 

composer update

Run database migrations:

php artisan migrate

Run Test

php artisan test

Seed the database:

php artisan db:seed --class=BookSeeder

Usage

The API should be available at http://localhost:3000/api (You can change the APP_PORT in .env file) if you are using artisan serve.

End Points

External endpoint

GET /api/external-books?name=:nameOfABook

Returns result from Ice And Fire API

Create

POST /api/v1/books

expected inputs

● name
● isbn
● authors
● country
● number_of_pages
● publisher
● release_date

Read

GET /api/v1/books

Read End points can also be searched with filters

GET /api/v1/books?filter[name]=game

Filters can also be chained

?filter[name]=game&filter[country]=United&filter[publisher]=Bantam&filter[release_date]=1996

Update

PATCH /api/v1/books/:id

Delete

DELETE /api/v1/books/:id

Alternative Delete

POST /api/v1/books/:id/delete

books-api's People

Watchers

Oluwakayode Adegbuyi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.