This project is a simple API for managing persons. It allows you to create, read, update, and delete persons.
Follow the steps below to get this API up and running on your local machine.
Make sure you have the following software/tools installed:
- PHP (>= 7.3)
- Composer
- Laravel (optional)
- MySQL (optional)
-
Clone the repository:
git clone https://github.com/tripletens/BackendZuriStageTwo.git
-
Change to the project directory:
cd BackendZuriStageTwo
-
Install PHP dependencies:
composer install
-
Generate a unique application key using the following command:
php artisan key:generate
- Open the .env file and configure your database connection settings. Set the DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, and DB_PASSWORD values according to your local database setup.
Save the changes to the .env file.
cp .env.example .env
-
Run the following command to create the database tables:
php artisan migrate
-
If your application has seeders, you can run them to populate the database with initial data:
php artisan db:seed
- To start a local development server, use the following command:
php artisan serve
This will start a development server at http://localhost:8000. You can access the Laravel application in your web browser at this address.
You can use this API to perform CRUD operations on persons. The API provides the following endpoints:
-
Create a Person
bash POST /api
- Request Body:
{ "name": "John Doe" }
- Request Body:
-
Fetch All Persons
bash GET /api
-
Fetch a Person by ID
bash GET /api/{id}
-
Update a Person by ID
bash PUT /api/{id}
- Request Body:
{ "name": "Updated Name" }
-
Delete a Person by ID
bash DELETE /api/{id}
To run the tests for this API, you can use the following command:
bash php artisan test
If you'd like to contribute to this project, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your changes to your fork.
- Create a pull request.
https://documenter.getpostman.com/view/21370111/2s9YC2ytRh
This project is open-source and available under the MIT License.
This `README.md` provides detailed instructions on how to set up, use, and contribute to your Person Management API project. Please make sure to update the placeholders and add more information as needed.