Route API

Submitted by fauzzi - 7 years ago

Simple api route for prefix and goup by middleware

This is a simple route for api, My endpoint api is http://domainnamme/api/v1/{api}
Route::group(['prefix' => 'v1'], function () {

    Route::post('login', 'API\AuthenticateController@authenticate');
    Route::post('register', 'API\AuthenticateController@register');
    
    Route::group(['middleware' => 'auth:api'], function () {
        
        // Authentication Routes...
        Route::get('logout', 'API\AuthenticateController@logout');
        
        Route::get('/test', function () {
            echo 'ok success';
        });
    });
});