rezabtuhin / laracrud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Logo

About project

It's a simple API request/response CRUD application made with Laravel.

Features

Method Name API call Response Note
POST User Registration api/register Success Require json body
POST Login api/login Authentication token Require json body
POST Add product api/products Created product Require authentication key & json body
GET Show all products api/products All products Requires nothing
GET Get specific product api/products/1 Returns product of id 1 (if exists) Requires nothing
PUT Update product api/products/1 Returns updated product of id 1 (if exists) Require authentication key & json body
DELETE Delete product api/products/1 Delete product of id 1 (if exists) Require authentication key
POST Logout api/logout Logout of the system Require authentication key

Accepted/Required json keys

Registration: name, email, password, password_confirmation
Login: email, password
Add products: name, slug, description, price
Update products: name, description, price [Note: not all the field is required here]

Postman configuration

Download and install the Postman desktop application. Create a new collection then create a new global variable token for authorization. Initialize the variable with the token from the response of login. Now navigate to the API request window, search for Authorization tab; Select type Bearer Token and set the token in the Token field. [NOTE: global variable token must be reinitialized with the new token value from the response of login every time after logout.]

  • Set Headers to accept application/json and use x-www-form-urlencoded where needed for convenience.

Installation

Your machine must have composer, php, xampp, git, node installed.

Step 1: Clone the repository/Download ZIP

https://github.com/rezabtuhin/laracrud.git

Step 2: Navigate to the project directory on your desktop.

Step 3: Open the terminal and run these commands (Requires all commands).

composer install
npm install
cp .env.example .env

Set up the database in the .env file and your MySQL server and configurations. Then run-

php artisan key:generate
php artisan migrate
php artisan serve

Sample postman config file: Download here.

Good luck 😃

About


Languages

Language:PHP 73.3%Language:Blade 26.4%Language:JavaScript 0.3%