Deploy React Laravel projects

If you are using Laravel as an API for the React.js application then set up the laravel project first. It is the backend here so setup the routes for the project. Use Urls for the SPI unique from other Urls Laravel is using. If your Laravel version has a Gup/build tool named Elixir it is for looking up script files etc in the resources folder so keep your files in its respective folders. After running  Elixir task for building the app the bundled app.js files will be put in public/js/app.js folder. Laravel views take public directory as default root directory so reference your built files in the index page as js/app.js. Then setup Routes for Laravel index page and API files. Route ‘/’ and all routes other than API to make index page view where we load our React.js application file.

Route::get('/', function () { return View::make('pages.index'); });

Route::group(['prefix' => 'api'], function () {

Route::get('tasks', 'TodosController@index');

});

To map requests to controller actions setup the routes. As long as the deployment goes build the code and load it into the index page.