Skip to content

cybernuki/Cart_Backend

Repository files navigation

Cart_Backend

shopping cart implementation in php

Enviroment:

laravel 7
mysql

Execution:

Before run the API sure that:
you're database is mysql
The service is running on port 3306
You have already a schema called cartproject

If it is the first time using this program use the following command to migrate the database:
php artisan migrate:fresh

After, you can use the following command to generate some data:
php artisan db:seed

Finally, Execute the API in the following way:
php artisan serve --port:3000

Please use port 3000 in order to use with the front-end project
Into the file tests/ you can find some request tests

Data Types:

Cart:

status: enum('pending','completed')

Product:

name: string
sku: string
description: string
price: float
imageUrl: string

ProductCar:

quantity: integer
product_id: integer
cart_id: integer

Routes:

Carts Routes:

GET|HEAD api/carts
POST api/carts
GET|HEAD api/carts/{cart_id}
PUT|PATCH api/carts/{cart_id}
DELETE api/carts/{cart_id}

Products Routes:

GET|HEAD api/products
POST api/products
GET|HEAD api/products/{product_id}
PUT|PATCH api/products/{product_id}
DELETE api/products/{product_id}

ProductCars Routes:

GET|HEAD api/product_cars
POST api/product_cars
GET|HEAD api/product_cars/{product_car_id}
PUT|PATCH api/product_cars/{product_car_id} // sending 0 as quantity in the request result in a delete from the database
DELETE api/product_cars/{product_car_id}

About

shopping cart implementation in php

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published