Skip to content

Instantly share code, notes, and snippets.

@blogcacanid
Last active June 20, 2020 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blogcacanid/5023cd35678d52af34b2a39f28aead8d to your computer and use it in GitHub Desktop.
Save blogcacanid/5023cd35678d52af34b2a39f28aead8d to your computer and use it in GitHub Desktop.
api.php Rest API Dengan JSON Web Token Laravel 7
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
// Route::middleware('auth:api')->get('/user', function (Request $request) {
// return $request->user();
// });
// Route::group(['middleware' => 'api','prefix' => 'auth'], function($router) {
Route::group(['middleware' => 'api'], function($router) {
Route::post('register', 'JWTAuthController@register');
Route::post('login', 'JWTAuthController@login');
Route::post('logout', 'JWTAuthController@logout');
Route::post('refresh', 'JWTAuthController@refresh');
Route::get('profile', 'JWTAuthController@profile');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment