A simple API News Management with CRUD News, Comment and Basic Auth with Laravel Passport
This API developed with PHP 8.1, Laravel Framework 10.18.0
Before you running the program, make sure you've run this command:
composer install
orcomposer update
- Rename
.env.example
to.env
- Generate the app key with
php artisan key:generate
- Run
php artisan passport:install
to create personal access client & password grant client
- 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
php -S localhost:8000 -t public
The program will run on http://localhost:8000
- email: admin@mail.com
- password: Pass1234
Method | URL | Description |
---|---|---|
POST | localhost:8000/login | Login User |
POST | localhost:8000/logout | Logout User |
GET | localhost:8000/news | Get All News |
POST | localhost:8000/news | Create News |
POST | localhost:8000/news/{newsUUID} | Update Detail News |
GET | localhost:8000/news/{newsUUID} | Get Detail News |
DELETE | localhost:8000/news/{newsUUID} | Delete News |
POST | localhost:8000/comments/{newsUUID} | Create Comment |