Code Monkey home page Code Monkey logo

book-api's Introduction

Book API: Laravel 7.24 based Book API with the front end created with Vue.js

How to install

  • Clone the repository with git clone
  • Copy .env.example file to .env and edit database credentials there (Rename .env.example to .env)
  • Configure the new .env file like this
    • DB_DATABASE=books_api
    • DB_USERNAME=root
    • DB_PASSWORD=
  • Run "composer install"
  • Run "php artisan key:generate"
  • Run "php artisan migrate --seed" or "php artisan db:seed" (it has some seeded data for testing)
  • For the front end install npm by running npm install, after that run "npm run dev" or "npm run wacth" to compile the components to Javascript

Book API Endpoints

The application is hosted on heroku, the endpoints are below

Testing The Application

Testing of the application is done with Laravel PHPunit

  • General testing of the application can be done by running this command:
    • vendor\bin\phpunit tests\Feature\BookApiTest.php
  • Testing each of the features can be done by running the below command
      • External book API
        • vendor\bin\phpunit --filter test_external_book
        • Please connect to the internet since is external API for the this test not to fail
      • Read API
        • vendor\bin\phpunit --filter test_index_book
      • Create API
        • vendor\bin\phpunit --filter test_create_book
      • Update API
        • vendor\bin\phpunit --filter test_update_book
      • Show Book API
        • vendor\bin\phpunit --filter test_show_book
      • 404 error for book not found
        • vendor\bin\phpunit --filter test_404_if_book_not_found
      • Delete Book API
        • vendor\bin\phpunit --filter test_delete_book
      • Edit Book API
        • vendor\bin\phpunit --filter test_edit_book

If the test is ran successfully without an error, it will look below

alt text

book-api's People

Contributors

dannyyol avatar

Watchers

 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.