Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy Laravel (backend) and React (frontend) HEROKU

I have laravel app (rest api) and react/js app (client side). I would like to deploy them on heroku. Its possible to reach that with putting them into one git repo and deploy? I tried to use post-install scripts but it didn't work. enter code here

EDIT. Added nodeJS buildpack (node installed on server) but it seems that Laravel covers react pages with Sorry, the page you are looking for could not be found.

like image 937
Skeldar Avatar asked Dec 03 '18 21:12

Skeldar


1 Answers

Just enter this code to your web.php:

Route::get('{reactRoutes}', function () {
return view('welcome');})->where('reactRoutes', '^((?!api).)*$');
like image 93
EugeneLobach Avatar answered Sep 26 '22 23:09

EugeneLobach