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条回答

    报告相同问题?

    悬赏问题

    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料