Skip to content

elnikova/cart-test

Repository files navigation

Laravel Logo

Build Status Total Downloads Latest Stable Version License

Installation

Project using PHP 8.3 / SQLite

  1. Run composer install.
  2. Run php artisan env:decrypt --key=73MIC0ayRQMduuF4wYpKDNzu8vUWQmgO
  3. Run php artisan migrate:fresh --seed
  4. Run php artisan serve
  5. Open http://127.0.0.1:8000 in your browser

API Routes

API Endpoint: http://127.0.0.1:8000/api

Please add Accept: application/json header to all your requests

Cart routes requires authentication, so please get token via "Login" route first

Login

Method: POST

URL: http://127.0.0.1:8000/api/login

Payload:

{
    "email": "user@test.com",
    "password": "password"
}

Use token from response to all auth routes. Add header Authorization: Bearer $token

Get Products

Method: GET

URL: http://127.0.0.1:8000/api/products

Get Cart

Method: GET

URL: http://127.0.0.1:8000/api/cart

Add items to cart

Method: POST

URL: http://127.0.0.1:8000/api/cart-items

Payload:

{
    "product_id": 1
}

Delete Items from cart

Method: DELETE

URL: http://127.0.0.1:8000/api/cart-items/{item_id}

Where item_id is items.*.id from Get Cart request

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors