简体   繁体   English

我应该有一个NodeJS服务器来响应服务器端渲染吗?

[英]Should I have a NodeJS server for react server-side rendering?

I have a API server which is written in python. 我有一个用python编写的API服务器。 And I wanted to render my react components on server side. 我想在服务器端渲染我的React组件。 So I searched the best practices and result was having a nodeJS server. 因此,我搜索了最佳实践,结果得到了一个nodeJS服务器。

But in my thoughts, this is weird because I have to build a another server with different language. 但是在我看来,这很奇怪,因为我必须用另一种语言构建另一台服务器。 This is bad at maintainable, and maybe have an overload. 这不好维护,并且可能会过载。

So I want to know having nodeJS server is usual. 所以我想知道通常有nodeJS服务器。 and also how do big companies do server-side rendering. 以及大公司如何进行服务器端渲染。

If it is as simple as wanting to use Python with React, you can use python-react to render React components. 如果想在React中使用Python一样简单,则可以使用python-react来呈现React组件。

As noted above, if you are using Flask, the templating is in Jinja2, but that isn't necessarily mutually exclusive to using React in your project. 如上所述,如果您使用Flask,则模板在Jinja2中进行,但这不一定与在项目中使用React互斥。

This resource on using Flask/React may be of use to you, as well. 使用Flask / React的资源也可能对您有用。

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

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