Answer the question
In order to leave comments, you need to log in
Single Page App. React/Laravel. How to do it right?
Hello!
So I created an application on React through Create-React-App, filed CORS on the backend, I use it as the Laravel API (it's not worth talking about what is better to use Lumen for api) - and then how to assemble this into one application? Well, I'll do npm run build for React, and what's next? I’m specifically when deploying on hosting
It’s also not worth writing about the fact that I’m down and didn’t buy out the simplest things, it’s obvious.
If I connect Laravel to the blade, then the react router works fine until I refresh the page, what should I do?
Answer the question
In order to leave comments, you need to log in
Only helped:
Route::get('{reactRoutes}', function () {
return view('welcome'); // your start view
})->where('reactRoutes', '^((?!api). )*$');
Thanks to all
Well, I'll do npm run build for React, and what's next? I specifically when deploying on a hosting
put it in a folder on the server and give it as normal nginx static
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question