Skip to content

Instantly share code, notes, and snippets.

@godilite
Last active February 7, 2020 15:37
Show Gist options
  • Save godilite/a093ad78be1ec7e761f11948b5400036 to your computer and use it in GitHub Desktop.
Save godilite/a093ad78be1ec7e761f11948b5400036 to your computer and use it in GitHub Desktop.
API Routes for Laravel API. Notice that there is an auth middleware on logout route
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| 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::group(['prefix' => 'v1'], function () {
Route::post('/login', 'UsersController@login');
Route::post('/register', 'UsersController@register');
Route::get('/logout', 'UsersController@logout')->middleware('auth:api');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment