This api made using Laravel 5.5, any extra package installed, There is 4 models:
- User : There is 2 types of users
- Authors : Who write the posts
- Visitors : Who comment on the posts
- Post : the post belongs to one User, and to many Categories, each Post has many Comments
- Comment : each comment belongs to User and Post
- Category : Each Category has many Posts
If you want to install the repo on your machine/server, just follow the following commands :
git clone git@github.com:kossa/fake-blog-api.git
cd fake-blog-api
composer install
cp .env.example .env # change the database information
php artisan migrate --seed
php artisan serve # open your browser to http://127.0.0.1:8000
Note : You can also use directly http://fakeblog.bel4.com/
verbs | URI | Description |
---|---|---|
Get | /posts | Get all posts |
Get | /posts/featured | Get feauted posts |
Get | /posts/popular | Get most visited posts |
Get | /posts/{post}/show | Get one post |
Get | /posts/{post}/comments | Get comments of a given post |
Get | /posts/{post}/author | Get author of a given post |
Get | /authors | Get list of authors |
Get | /authors/{id}/show | Get an author |
Get | /authors/{id}/posts | Get posts of an author |
User
: Total of 20 users, 10 authors, 10 visitorsCategory
: 20 categoriesPost
: 500 postsComment
: 10 000 comments
Very easy, just add an issue
Again easy, just add an issue