简体   繁体   English

ReactJS 与 rails 集成或分离的 rails api

[英]ReactJS integrated with rails or separated rails api

Ok guys i was thinking about this question and didnt find anything related or that could clarify my mind about this.好的,我正在考虑这个问题,但没有找到任何相关的信息,或者可以澄清我对此的看法。 Its not an issue that im facing right now, its more curiosity and maybe it could help someone someday.这不是我现在面临的问题,它更多的是好奇心,也许有一天它可以帮助某人。

Whats the best way or best practice to create a reactjs application?创建 reactjs 应用程序的最佳方法或最佳实践是什么? Integrated with rails?与导轨集成? Or with a separated rails api and separated reactjs?或者使用单独的rails api和单独的reactjs?

I would say separate them.我会说把它们分开。 If you ever wanted to rebuild your API with Node.js or Python for example, it will make it much easier than trying to rip out all of your Rails code, and Vice Versa– If you wanted to keep your Rails API and build out a new front-end with Angular it makes it easier.例如,如果你想用 Node.js 或 Python 重建你的 API,这比试图撕掉你所有的 Rails 代码要容易得多,反之亦然——如果你想保留你的 Rails API 并构建一个带有 Angular 的新前端使它变得更容易。

Another thing to keep in mind is scalability.要记住的另一件事是可扩展性。 When your front-end code is separate from your back-end code, you can scale up your backend independently, which would ultimately save you money.当您的前端代码与后端代码分离时,您可以独立扩展后端,这最终会为您节省资金。 This is more applicable to large scale applications though.不过,这更适用于大规模应用。

Also deployment.还有部署。 If you need to make updates to your API, you shouldn't have to re-deploy all of your front end code as well.如果您需要对 API 进行更新,则不必重新部署所有前端代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM