Skip to content

amalSheikhdaher/Movie_Library_API

Repository files navigation

Movie Library API

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.

Table of Contents

Prerequisites

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

Installation

  1. Clone the Repository:
git clone https://github.com/amalSheikhdaher/Movie_Library_API.git
  1. Install Dependencies:
composer install
  1. Copy Environment File:
cp .env.example .env
  1. Generate Application Key:
 php artisan key:generate
  1. Set Up the Database:

    Update your .env file 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=
  1. Run Migrations:
php artisan migrate

Running the Application

Start the Laravel development server:

php artisan serve

Your application will be accessible at http://localhost:8000.

API Endpoints

Here are some of the primary endpoints for managing movies:

  • List Movies:

    • GET /api/movies
    • Retrieves a list of all movies.
  • Get Movie Details:

    • GET /api/movies/{id}
    • Retrieves details of a specific movie.
  • Create a Movie:

    • POST /api/movies
    • Creates a new movie. Requires a JSON body with movie details.
  • Update a Movie:

    • PUT /api/movies/{id}
    • Updates details of a specific movie. Requires a JSON body with updated movie details.
  • Delete a Movie:

    • DELETE /api/movies/{id}
    • Deletes a specific movie.

Testing with Postman

To test the API using Postman:

  1. Import Postman Collection:

  2. Set Up Environment:

    • Set up a Postman environment with the base URL (e.g., http://localhost:8000).
  3. 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.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors