I have working application on symfony with twig template engine. It is very usefull to have app.request
and app.user
objects and utils like is_granted('ROLE_MODER')
in template. Is there way for handling all this in react js? For example for routes i think i could use FOS JsRouting bundle, but i couldn't find any opportunity how could i access app
object or granting function in react js.
将Symfony安全性和其他模板实用程序与ReactJS集成
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- donglu8334 2017-06-17 09:10关注
You could struct your application using HATEOAS:
https://github.com/willdurand/Hateoas
and also a REST bundle
http://symfony.com/doc/current/bundles/FOSRestBundle/index.html
Finally, to keep everything in security you can work with symfony's Voter/or ACL:
http://symfony.com/doc/current/security/voters.html
and keep all the control you need.
If you want to tell symfony information to reactjs, just create an endpoint for this. If you want to build a react component that handle with symfony's part, build it using twig.
But I suggest you to consider your symfony part as a REST API. I mean, ... you are just talking with an API. Your ReactJs client should never know that that API is written in Symfony.
解决 无用评论 打赏 举报
悬赏问题
- ¥15 stable diffusion
- ¥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系统的像差计算