[Introduce your project here]
HTTP Method | URL Path | Middleware |
---|---|---|
POST | /api/v1/register | none |
POST | /api/v1/login | none |
POST | /api/v1/logout | auth:api |
POST | /api/v1/refresh | auth:api |
POST | /api/v1/me | auth:api |
POST | /api/v1/product | auth:api |
GET | /api/v1/product | auth:api |
GET | /api/v1/product/{product} | none |
PUT | /api/v1/product/{product} | auth:api |
DELETE | /api/v1/product/{product} | auth:api |
GET | /api/v1/products/all | none |
GET | /api/v1/productsWithPageination | none |
POST | /api/v1/category | auth:api |
GET | /api/v1/category | auth:api |
GET | /api/v1/category/{category} | none |
PUT | /api/v1/category/{category} | auth:api |
DELETE | /api/v1/category/{category} | auth:api |
GET | /api/v1/categories | none |
POST | /api/v1/order | auth:api |
GET | /api/v1/order | auth:api |
GET | /api/v1/order/{order} | auth:api |
PUT | /api/v1/order/{order} | auth:api |
DELETE | /api/v1/order/{order} | auth:api |
To set up the Laravel project, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/your-repository.git cd your-repository
-
Install dependencies:
composer install npm install
-
Copy the
.env
file:cp .env.example .env
-
Generate an application key:
php artisan key:generate
-
Set up the database:
- Open the
.env
file and configure your database settings. - Run the following command to migrate the database:
php artisan migrate
- Open the
-
Run the development server:
php artisan serve
-
Compile the assets:
npm run dev
To use the API, you can make HTTP requests to the specified endpoints. Below are some examples using curl
:
-
Register:
curl -X POST -d "name=John Doe&email=johndoe@example.com&password=password" http://localhost:8000/api/v1/register
-
Login:
curl -X POST -d "email=johndoe@example.com&password=password" http://localhost:8000/api/v1/login
-
Logout:
curl -X POST -H "Authorization: Bearer {token}" http://localhost:8000/api/v1/logout
-
Get All Products:
curl -X GET http://localhost:8000/api/v1/products/all
-
Get Product by ID:
curl -X GET http://localhost:8000/api/v1/product/{product_id}
- Get All Categories:
curl -X GET http://localhost:8000/api/v1/categories
- Create Order:
curl -X POST -H "Authorization: Bearer {token}" -d "product_id=1&quantity=2" http://localhost:8000/api/v1/order
- Fork the repository.
- Create your feature branch (
git checkout -b feature/AmazingFeature
). - Commit your changes (
git commit -m 'Add some AmazingFeature'
). - Push to the branch (
git push origin feature/AmazingFeature
). - Open a pull request.
Distributed under the MIT License. See LICENSE
for more information.