I want to make a Laravel 5.1 application for web and api's for mobile apps. I want to return json for api request and view for web browser. Currently I have setup different routes and different controllers. In this approach I'm repeating the code. I don't know what is the best approach to design this architecture. Also, I've gone through few similar threads which recommends using angular.js for web browser.
// web controller
Route::resource('product', 'ProductController');
// api controller
Route::group(['prefix' => 'api'], function() {
Route::resource('product', 'APIProductController');
});
Aucun commentaire:
Enregistrer un commentaire