Welcome to the Movie Library API project built with Laravel 10. This project provides a backend API for managing movies, including CRUD operations, using Laravel's robust features.
Before you begin, ensure you have met the following requirements:
- PHP 8.0 or higher
- Composer
- Laravel 10
- MySQL or another supported database
- Postman for testing
- Clone the Repository:
git clone https://github.com/amalSheikhdaher/Movie_Library_API.git
- Install Dependencies:
composer install
- Copy Environment File:
cp .env.example .env
- Generate Application Key:
php artisan key:generate
-
Set Up the Database:
Update your
.envfile with your database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=movie_library_api
DB_USERNAME=root
DB_PASSWORD=
- Run Migrations:
php artisan migrate
Start the Laravel development server:
php artisan serve
Your application will be accessible at http://localhost:8000.
Here are some of the primary endpoints for managing movies:
-
List Movies:
- GET
/api/movies - Retrieves a list of all movies.
- GET
-
Get Movie Details:
- GET
/api/movies/{id} - Retrieves details of a specific movie.
- GET
-
Create a Movie:
- POST
/api/movies - Creates a new movie. Requires a JSON body with movie details.
- POST
-
Update a Movie:
- PUT
/api/movies/{id} - Updates details of a specific movie. Requires a JSON body with updated movie details.
- PUT
-
Delete a Movie:
- DELETE
/api/movies/{id} - Deletes a specific movie.
- DELETE
To test the API using Postman:
-
Import Postman Collection:
-
Set Up Environment:
- Set up a Postman environment with the base URL (e.g.,
http://localhost:8000).
- Set up a Postman environment with the base URL (e.g.,
-
Run Requests:
- Use the imported collection or manually create requests to test the API endpoints.
- Ensure you send the appropriate headers, such as
Content-Type: application/json, and include any required authentication tokens if necessary.
This project is licensed under the MIT License.