/api-product-test

Simple API Product with Auth

Primary LanguagePHP


API Product Test

Description

A simple API Product with CRUD function and JWT auth.

Features

This API developed with PHP 8.0, Lumen Framework 9.0

Tech Used

PHP JWT Laravel MySQL Postman

Getting Start:

Before you running the program, make sure you've run this command:

  • composer install or composer update
  • Rename .env.example to .env
  • Generate the jwt secret key with php artisan jwt:secret

Database setup:

  • Create your own database, and put the credential in env file
  • Run the migration with php artisan migrate
  • Run db seeder with php artisan db:seed --class=UsersTableSeeder

Run the program

php -S localhost:8000 -t public

The program will run on http://localhost:8000

Credential Account

API Route List

Method URL Description
POST localhost:8000/login Login User
POST localhost:8000/logout Logout User
GET localhost:8000/product Get All Product
POST localhost:8000/product Create & Update Product (Add 'id' params in request body for the update function)
GET localhost:8000/product/{id} Get Detail a Product
DELETE localhost:8000/product/{id} Delete a Product

Screenshots