简体   繁体   English

Next.js 是否需要运行节点服务器?

[英]Does Next.js Needs a Node Server Running?

If I don't care SEO at all then I can use React right?如果我根本不关心 SEO,那么我可以使用 React 对吗? But I care SEO and I also don't want to use a node server.但我关心 SEO,我也不想使用节点服务器。

Because I have an API with PHP and I send a request there then write it to react page.因为我有一个带有 PHP 的 API 并且我在那里发送一个请求然后将其写入响应页面。 I use PHP with Back-End and React with Front-End but I also care SEO and I don't have a node server.我将 PHP 与后端一起使用,并与前端一起使用,但我也关心 SEO,而且我没有节点服务器。 Can i use Next.js without a node server.我可以在没有节点服务器的情况下使用 Next.js 吗? I've searched for it, and I saw that I don't need a node server with "static" web pages with Next.js but can't i send API requests?我已经搜索过了,我发现我不需要带有“静态”web 页面和 Next.js 的节点服务器,但我不能发送 API 请求吗?

Any page that uses getServerSideProps, Next.js converts that page to a lambda function.任何使用 getServerSideProps、Next.js 的页面都会将该页面转换为 lambda function。 You don't need a node server running 24/7 for hosting your application.您不需要运行 24/7 的节点服务器来托管您的应用程序。

Also, if you don't use getServerSideProps, Next.js by default will pre-render your page, this page gets cached on a CDN.此外,如果您不使用 getServerSideProps,默认情况下 Next.js 将预渲染您的页面,此页面将缓存在 CDN 上。

So yes you can make API calls to your PHP backend, without the need for a setting up a nodejs server yourself.所以是的,您可以对 PHP 后端进行 API 调用,而无需自己设置 nodejs 服务器。

Hope that answers your question.希望这能回答你的问题。

Thanks谢谢

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

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