This API is created using Laravel 9.19 API Resource. It has Users, Product. Protected routes are also added. Protected routes with Laravel Sanctum.
- User
- Product
Clone the project via git clone or download the zip file.
Copy contents of .env.example file to .env file. Create a database and connect your database in .env file.
cd into the project directory via terminal and run the following command to install composer packages.
$ composer install
then run the following command to create migrations in the databbase.
$ php artisan migrate
$ php artisan serve
in the folder "postman" has file "mock-test-binar.postman_collection.json". import the file to your postman
- "Register" POST http://localhost:8000/api/register
- "Login" POST http://localhost:8000/api/login
- "Logout" POST http://localhost:8000/api/logout
- "Get All Product" GET http://localhost:8000/api/products
- "Create Product" POST http://localhost:8000/api/products
- "Get Detail Product By id" POST http://localhost:8000/api/products/1
- "Update Product By id" POST http://localhost:8000/api/products/1 with _method PATCH
- "Delete Product By id" POST http://localhost:8000/api/products/1