This repo contains a solution to an assessment, i.e to build a blogging system with REST API endpoints for interaction and CRUD functionalities.
You will need the following tools installed on your computer to run the project.
-
Clone the repo
git clone https://github.com/Di-void/courierplus-blog-api.git cd courierplus-blog-api
-
Install dependencies
Run Composer to install the required PHP packages.
composer install
-
Environment setup
Copy the example environment file to your environment file.
cp .env.example .env
-
Generate application key
php artisan key:generate
-
Database migration and seeding
Note
This command will seed the database with a test, authenticated
user that will be used to interact with the various actions in the system.
php artisan migrate --seed
-
Start the development server
php artisan serve
This will start the application on http://127.0.0.1:8000
-
API Testing (with Postman)
To run tests:
php artisan test
-
List all artisan commands
php artisan list
List of API endpoints.
GET /api/v1/blogs
- Fetch all blogsPOST /api/v1/blogs
- Create a new blogGET /api/v1/blogs/{id}
- Read a blogPATCH /api/v1/blogs/{id}
- Update a blogDELETE /api/v1/blogs/{id}
- Delete a blog
GET /api/v1/posts
- Fetch all postsPOST /api/v1/posts
- Create a new postGET /api/v1/posts/{id}
- Read a postPATCH /api/v1/posts/{id}
- Update a postDELETE /api/v1/posts/{id}
- Delete a postPOST /api/v1/posts/{id}/like
- Like a postPOST /api/v1/posts/{id}/comment
- Comment on a post