This is a demo application for a abooks api using lumen.
- GET /books - get books
- GET /books/{bookId}}/characters - get characters in abook
- GET /books/{bookId}/comments - get comments on abook
- POST /books/{bookId}/comments - create a comment on abook
Open api documentation for the endpoints can be found Here:Open api docs. Postman documentation can be found Here:Postman docs.
The app can easily be deployed using docker to any cloud service that supports docker. from the docker file in the root of the repository
- clone the repo
- run
composer install
- Migrate the database
run
php artisan migrate
- Run tests
run
vendor/bin/phpunit
- Seed the database:
php artisan db:seed
- Start the local php server :
php -S localhost:8000 -t ./public
- open http://localhost:8000/books
The application has mainly four models:
- Book
- Author
- Comment
- Character
The book model has the following fields:
- id: the primary key
- name: the title of the book
- isbn: the isbn of the book
- publisher: the books publisher
- country: the books country
- release_date: the date of the book release
- number_of_pages: the number of pages in the book
It has a one to many relationship with Author
.
The author model has the following fields:
- id: the primary key
- name: the name of the author
It has a one to one relationship with Book
.
The comment model has the following fields:
- body: The comment text
- ip_address: Ip address of the commenter
- book_id: The id of the book the comment is for
It has a one to one relationship with Book
.
The character model has the following fields: -id: the primary key
- name - name of the character
- gender - gender of the character
- culture - the culture the character belongs to
- aliases - other names of the character
- born - date of birth of the character
- died - the date the character died
It has a one to many relationship with Book
.
The Lumen framework is open-sourced software licensed under the MIT license.