W
W
webdevhero2017-07-29 13:05:05
Laravel
webdevhero, 2017-07-29 13:05:05

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

4 answer(s)
W
webdevhero, 2017-07-29
@webdevhero

Only helped:
Route::get('{reactRoutes}', function () {
return view('welcome'); // your start view
})->where('reactRoutes', '^((?!api). )*$');
Thanks to all

O
Oleg Gamega, 2017-07-29
@gadfi

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

A
Arman, 2017-07-29
@Arik

Isn't that Envoy Task Runner ? We unfold everything through it

R
Roman Alexandrovich, 2017-07-29
@RomReed

https://medium.com/@adelekandavid2013/reactjs-app-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question