Giter Site home page Giter Site logo

sc-rest-api's Introduction

SC REST API

Installation

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

Database seeding

Run the database seeder

php artisan db:seed

Note : It's recommended to have a clean database before seeding.

php artisan migrate:refresh --seed

Running

Start the local development server

php artisan serve

Testing

Run Codeception

php vendor/bin/codecept build
php vendor/bin/codecept run

HTTP Methods

List all products

curl -X GET http://localhost:8000/api/products

Retrieve a single product

curl -X GET http://localhost:8000/api/products/{id}

Create product

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
 }'

Update product

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
 }'

Delete product

curl -X DELETE http://localhost:8000/api/products/{id}

List product categories

curl -X GET http://localhost:8000/api/products/{id}/categories

sc-rest-api's People

Contributors

gabehenriques avatar dependabot[bot] avatar

Watchers

 avatar

Forkers

wahyubotz78

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.