This project is a simple RESTful API built using Laravel for managing a book. It includes features for creating, retrieving, updating, and deleting books.
Follow these steps to run the project locally:
-
Set Up the Database:
Make sure you have a MySQL database set up. Update the
.env
file with your database connection details. -
Run Migrations:
php artisan migrate
-
Seed the Database:
php artisan db:seed --class=BookSeeder
-
Start the Development Server:
php artisan serve
The server will start at http://localhost:8000
.
- Endpoint:
GET /api/book
- Description: Retrieve a list of all books.
- Endpoint:
GET /api/book/{id}
- Description: Retrieve a specific book by ID.
- Endpoint:
POST /api/book
- Description: Create a new book.
- Endpoint:
PUT /api/book/{id}
- Description: Update a specific book by ID.
- Endpoint:
DELETE /api/book/{id}
- Description: Delete a specific book by ID.
The API Postman Collection is available in the /postman-collection/ directory.
The database schema includes the following table:
- Table Name:
books
id
: Auto-incremental primary keytitle
: Title of the book (string)author
: Author of the book (string)published_date
: Published date of the book (date)created_at
andupdated_at
: Timestamps for creation and last update
If you find any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request.
Happy coding!ππ¨βπ»