dongqie7806 2017-10-03 16:08
浏览 58

如何在两个React项目中使用一个Laravel实例

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?