To run this project locally, follow the steps below:
-
Clone the repository:
git clone https://github.com/your-username/hereinafter-library.git
-
Navigate to the project directory:
cd hereinafter-library
-
Install dependencies:
composer install
-
Create a copy of the
.env.example
file and rename it to.env
:cp .env.example .env
-
Generate an application key:
php artisan key:generate
-
Configure your database settings in the
.env
file. -
Run database migrations:
php artisan migrate
-
Seed the database (if needed):
php artisan db:seed
-
Start the development server:
php artisan serve
-
The API will be available at
http://127.0.0.1:8000
by default.
Delete a book from the library.
- URL:
http://127.0.0.1:7600/api/book/2
- Method:
DELETE
- Authorization: Bearer Token
- Token:
<token>
- Status:
204 No Content
Get the user token for authentication.
- URL:
http://127.0.0.1:7600/api/test/get-token/6
- Method:
GET
- Status:
200 OK
- Body:
<token>
Add a new book to the library.
- URL:
http://127.0.0.1:7600/api/book
- Method:
POST
- Authorization: Bearer Token
- Token:
<token>
- Body: form-data
name
: Test Book 3author_ids
: 5,7
- Status:
201 Created
- Body: JSON representation of the newly created book
Modify details of a book in the library.
- URL:
http://127.0.0.1:7600/api/book/3
- Method:
PUT
- Authorization: Bearer Token
- Token:
<token>
- Query Params:
name
: Test
- Status:
200 OK
- Body: JSON representation of the modified book