Clone the repository
git clone [email protected]:henriquesgabriel/sc-rest-api.git
Switch to the repo folder
cd sc-rest-api
Install all the dependencies using composer
composer install
Copy the example env file and make the required configuration changes in the .env file
cp .env.example .env
Generate a new application key
php artisan key:generate
Run the database migrations (Set the database connection in .env before migrating)
php artisan migrate
Run the database seeder
php artisan db:seed
Note : It's recommended to have a clean database before seeding.
php artisan migrate:refresh --seed
Start the local development server
php artisan serve
Run Codeception
php vendor/bin/codecept build
php vendor/bin/codecept run
curl -X GET http://localhost:8000/api/products
curl -X GET http://localhost:8000/api/products/{id}
curl -X POST http://localhost:8000/api/products \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": String,
"sku": String,
"price": Float,
"category_id": Integer
}'
curl -X PUT http://localhost:8000/api/products/{id} \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": String,
"sku": String,
"price": Float,
"category_id": Integer
}'
curl -X DELETE http://localhost:8000/api/products/{id}
curl -X GET http://localhost:8000/api/products/{id}/categories