Route API

Submitted by fauzzi - 1 month 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';
        });
    });
});

Ads cover the costs of maintaining Laravel-tricks

comments powered by Disqus

Ads cover the costs of maintaining Laravel-tricks