Laravel was used to develop the application because it is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
In order to setup the application locally on you system.
- clone the repository
git clone https://github.com/willypelz/books-api.git
- cd into the project directory
cd books-api
- install the dependencies for the application
composer install
- create a .env file from the .env.example
cp .env.example .env
- Generate an application key
php artisan key:generate
- create a database called
booksapi
in your database - update the env files with your mysql connection details that you have on your system
DB_CONNECTION=mysql
DB_HOST=YOUR_HOST
DB_PORT=MYSQL_PORT
DB_DATABASE=booksapi
DB_USERNAME=MYSQL_USER_NAME
DB_PASSWORD=MYSQL_PASSWORD
- ensure the iceandfire base api is being setup in the .env files
- ICE_AND_FIRE_URL='https://www.anapioficeandfire.com/api/' **** IT HAS BEEN TAKEN CAREOF: JUST FOR EASY TESTING
- Running migration data into the database
php artisan migrate
- serving the project
php artisan serve
Application Testing is defined as a software testing type, conducted through scripts with the motive of finding errors in software. It deals with tests for the entire application. It helps to enhance the quality of your applications while reducing costs, maximizing ROI, and saving development time.
In order to run the feature test that was written
php ./vendor/bin/phpunit
when you want to generate a coverage
php ./vendor/bin/phpunit --coverage-html ./coverage
This generates html report files in the application in the coverage folder, which can be located in the root directory
Ensure you setup xdebug on your system. Xdebug Setup for local machine (xampp)
-
Note:: ** when creating an author in the application you have to arrange the name of the authors separated with commas
-
when testing the external application you can use any of the strings to search for the name of the book
"name" or "name or name" or name
- To filter the books you need to search with you desired parameters as shown below
http://localhost:8000/api/v1/books?search=Game of throne
http://localhost:8000/api/v1/books?search="Game of throne"
http://localhost:8000/api/v1/books?search=2020
Please note that the /
is for linux and mac terminal which applies to bash terminal also.
if you are using window command line with no bash you will have to use the \
- To view the test coverage
- navigate to the coverage folder
- click on the
index.html
open with any browser - To see risk report
- In the coverage folder
- click in the
dashboard.html
open with any browser (100% free from risk)
- There are still advance optimization and refactoring that can still be done in this project
- More validation checks. The validation checks can be increased to take care of users mistake and other case senarios
- Name: Asefon Michael Pelumi
- Nickname: Softwaredef
- Mail: pelumiasefon@gmail.com
Thanks. If you have any problem setting it up or complain you can kindly post them on issues or message me directly