mardi 3 octobre 2017

How to use one Laravel instance for two React projects

I have two react projects created by create-react-app kit which both will use same database and some shared models. For backend i've created one Laravel project and in it's public directory i've put React projects :

--Laravel project
 |-- app
 |-- bootstarp
 ...
 |-- public
   |-- frontend (react app)
   |-- panel (react app)
   |-- index.php (Laravel's index)
 ...
 |-- vendor
 |-- .env

Since i'm going to use Laravel just for REST api, i've set up 3 domains like :

frontend.local
panel.frontend.local
api.frontend.local

The reason for doing this, is that i don't want to recreate database or shared models for each project and right now everything works great. I can access projects and i can send api requests too. So my question is : Is this approach good ? and if it's not, how can i have one instance of Laravel app for two react apps.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire