- PHP 7.3 | 8.0
Setting up project in development mode:
- Ensure PHP 7.3 or greater is installed by running:
- Clone the repository to your machine and navigate into it:
- Install application dependencies
- Create a .env file and include the necessary environment variables. NB- copy from the .env.example and fill in the correct values
php -v
git clone https://github.com/josephkipkemoi/larablog
composer update
Setup database locally on your machine, add larablog as a value to the respective environment variable as below:
- mysql -p['password']
- CREATE DATABASE larablog;
- exit;
Inside the root folder, run the following commands in your terminal
- $ php artisan key:generate
- $ php artisan migrate:fresh
- $ php artisan db:seed
- $ php artisan serve
- $ ./vendor/bin/phpunit
- $ php artisan test
Or
METHOD | END POINT | PARAMS |
---|---|---|
POST | /register | json {"name":"Albert Einsten","email":"alber@gmail.com" , "password":"password", "confirm_password":"password"} |
POST | /login | json {"email":"alber@gmail.com", "password": "password"} |
METHOD | END POINT | PARAMS |
---|---|---|
POST | api/v1/blogs | json {"title":"Some cool blog title", "author": "$user->name | Guest", "body":"Some long or shor blog body", "user_id":"$user->id"} |
GET | api/v1/blogs | N/A |
PATCH | api/v1/blogs/{$blog->id} | json {"title":"updated title", "body":"updated body", "author":"Andrew Meakings"} |
GET | api/v1/blogs/{$blog->id} | N/A |
DELETE | api/v1/blogs/{$blog->id} | N/A |
METHOD | END POINT | PARAMS |
---|---|---|
POST | api/v1/tags | json {"tag":"laravel"} |
GET | api/v1/tags/{$blog->id} | N/A |
GET | api/v1/tags/{$tag->id}/blogs | N/A |
METHOD | END POINT | PARAMS |
---|---|---|
POST | api/v1/blogs/{$blog->id}/comments | json {"user_id":"$user->id","blog_id":"$blog->id","comment_body":"some cool comment"} |
GET | api/v1/blogs/{$comment->blog_id}/comments/{$comment->id} | N/A |
PATCH | api/v1/blogs/{$comment->blog_id}/comments/{$comment->id} | json {"comment_body":"updated comment body"} |
DELETE | api/v1/blogs/{$comment->blog_id}/comments/{$comment->id} | N/A |
METHOD | END POINT | PARAMS |
---|---|---|
POST | api/v1/categories | json {"category":"sports"} |
GET | api/v1/categories/{$category->id} | N/A |