A simple Laravel API.
- Clone the repository
git clone https://github.com/danielgogov-github/Laravel_API.git
- Install all composer packages
composer install
- Copy .env
cp .env.example .env
- Set database, database username and database password
DB_DATABASE=laravel_api
DB_USERNAME=username
DB_PASSWORD=password
- Generate application key
php artisan key:generate
- Do migration
php artisan migrate
- Fill the table with data
php artisan db:seed
- Run the web server
php artisan serve
- Show all products
- Show a single product
- Create a new product
- Edit a product
- Delete a product
Method | Route | Description |
---|---|---|
GET |
/api | View all products |
GET |
/api/{id} | View a single product |
POST |
/api | Create a new product |
PUT |
/api/update/{id} | Update a product |
DELETE |
/api/destroy/{id} | Delete a product |