Rest api for creating blog posts, getting them as well as deleting and updating them.
- composer is set up globally
- php is also installed
- Install vendor stuff
composer install - Create .env file from .env.example
@php -r "file_exists('.env') || copy('.env.example', '.env');" - Then set up Homestead
php vendor/bin/homestead make - Set up and boot virtual machine
vagrant up - Now go inside vagrant machine
vagrant ssh - Create db tables with migration command (inside vagrant!)
php code/artisan migrate - Then populate categories table with some data
php code/artisan db:seed(also inside vagrant!) - Done, you can now see the list of categories
GET /api/categoriesand query another endpoints (see host in Homestead.yaml)
GET /api/categories
GET /api/posts
POST /api/posts - supports JSON payload
PUT /api/posts/{id} - supports JSON payload
GET /api/posts/{id}
DELETE /api/posts/{id}
{
"title": "The coolest post",
"body": "lorem ipsum...",
"category_id": 1
}
Just run composer test