Sebuah web API sederhana CRUD buku.
- clone this repo
git clone https://github.com/ahmaruff/pescer23-demo-backend.git
- run
composer install
- copy
.env-example
to.env
- set DATABASE configuration in
.env
file - run migration
php artisan migrate
- run web server
php artisan serve
- start cosume API via browser or API Client.
METHOD | PATH | PARAMETER | BODY REQUEST | DESC |
---|---|---|---|---|
GET | / | n/a | n/a | return app name, desc, and laravel version |
GET | /books | n/a | n/a | return array of books |
POST | /books | n/a | title, author, category['fiction', 'non-fiction'], description | create new book record |
GET | /books/{id} | id: int | n/a | return single book record |
PUT | /books/{id} | id: int | title, author, category['fiction', 'non-fiction'], description | update book record |
DELETE | /books/{id} | id: int | n/a | delete book record |
all response should be in json. following JSend Standard.
The HTTP code will be 400 (Bad Request) for all errors unless stated otherwise.
{
status : "success|fail|error"
code : "HTTP_STATUS_CODE"
message : "custom message"
data : {
// data goes here
}
}