Skip to content

Instantly share code, notes, and snippets.



Last active Jun 20, 2020
What would you like to do?
api.php Rest API Dengan JSON Web Token Laravel 7
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