This project is a simple Task Management API built with Laravel. It allows users to create and retrieve tasks via RESTful endpoints. This guide will help you get started with setting up the project using Docker and running tests.
Before you begin, make sure you have Docker installed on your system. If you don't have Docker, you can download and install it from Docker's official website.
-
Clone the Repository
First, clone the repository to your local machine:
git clone [email protected]:akouyate/test-laravel.git cd test-laravel
-
Start Docker Containers
Run the following command to build and start the Docker containers:
docker-compose up -d
This will set up all the necessary services, such as the Laravel application server, database, etc.
-
Install Dependencies
Next, install the PHP dependencies using Composer:
docker-compose exec laravel.test composer install
-
Environment Configuration
Copy the example environment file to create your own environment configuration:
docker-compose exec laravel.test cp .env.example .env
-
Run Migrations
To set up your database schema, run the migrations:
docker-compose exec laravel.test php artisan migrate
To run the test suite, use the following command:
docker-compose exec laravel.test ./vendor/bin/pest
This will execute all the tests written using Pest PHP testing framework.
The API currently supports the following endpoints:
POST /api/tasks
: Create a new task.GET /api/tasks/:id
: Retrieve the details of a specific task by its unique identifier (ID).
This endpoint creates a new task. You need to provide task details in the request body.
Request Body Example:
{
"text": "Sample Task",
"tasks": ["call_reason", "call_actions"]
}
This endpoint allows you to request detailed information about a single task, such as its description, status, and any other relevant data associated with it.
Usage Example:
To fetch details of a task with a specific ID, you would make a GET request to /api/tasks/{task_id}
, where {task_id}
is replaced with the actual ID of the task you want to retrieve.
Response Example:
The response will contain the detailed information of the specified task in JSON format.
{
"id": "uuid",
"text": "Sample Task",
"tasks": ["call_reason", "call_actions"]
}