Skip to content

Commit

Permalink
Update: Create Controller & routes for API Endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Ph.Hitachi authored and Ph.Hitachi committed Aug 13, 2023
1 parent a134e1a commit 77d294b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AuthController;

/*
|--------------------------------------------------------------------------
Expand All @@ -14,6 +15,12 @@
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
Route::middleware('auth.token')->get('/me', function (Request $request) {
return $request->user();
});

Route::controller(AuthController::class)->group(function ($router) {
Route::post('login', 'login')->name('login');
Route::post('logout', 'logout')->name('logout')->middleware('auth.token');
Route::post('refresh', 'refresh')->name('refresh');
});

0 comments on commit 77d294b

Please sign in to comment.