Skip to content

josephkipkemoi/lara-blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup

Deployed APP

Dependencies

  • PHP 7.3 | 8.0

Getting Started

Setting up project in development mode:

  • Ensure PHP 7.3 or greater is installed by running:
  • php -v

  • Clone the repository to your machine and navigate into it:
  • git clone https://github.com/josephkipkemoi/larablog

  • Install application dependencies
  • composer update

  • Create a .env file and include the necessary environment variables. NB- copy from the .env.example and fill in the correct values

Database Setup

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;

Running the application

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

Running the tests

  • $ ./vendor/bin/phpunit
  • Or

  • $ php artisan test

API

User Registration and Authentication

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"}

Blog Post(s)

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

Tag(s)

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

Comment(s)

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

Category

METHOD END POINT PARAMS
POST api/v1/categories json {"category":"sports"}
GET api/v1/categories/{$category->id} N/A

About

Laravel blog API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages