PHP Classes

File: routes/api.php

Recommend this page to a friend!
  Classes of uche  >  PHP Article System API  >  routes/api.php  >  Download  
File: routes/api.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Article System API
Manage collections of articles using API requests
Author: By
Last change:
Date: 8 months ago
Size: 1,172 bytes
 

Contents

Class file image Download
<?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!
|
*/

    //authentication
   
Route::post('/register', 'AuthController@register');
   
Route::post('/login', 'AuthController@login');

   
//endpoints with auth
   
Route::group(['prefix' => '/articles', 'middleware' => 'auth:api'], function(){
       
Route::post('/', 'ArticleController@store');
       
Route::put('/{id}', 'ArticleController@update');
       
Route::delete('/{id}', 'ArticleController@delete');
    });
   
//endpoints without auth
   
Route::group(['prefix' => '/articles'], function(){
       
Route::get('', 'ArticleController@index');
       
Route::get('/{id}', 'ArticleController@show');
       
Route::post('/{id}/rating', 'ArticleController@rating');
       
Route::get('/search/{query}', 'ArticleController@search');
    });


For more information send a message to info at phpclasses dot org.