netlify仅在部署时才会与 /graphql抛出404错误

发布于 2025-02-12 11:28:09 字数 649 浏览 0 评论 0原文

几天前,我有一个我推到Heroku的应用程序,在该应用程序正常工作,但是部署该应用程序进行NetLify时,该应用程序会部署,但是GraphQL连接会引发404个错误。这是一些图像。

中使用的代码

这是我在app.js

是否有人知道我如何解决这个问题?非常感谢

I have an app which I had pushed to heroku a few days ago, where it works fine, but when deploying the app to Netlify, the app deploys but the graphQL connection throws a 404 error. Here are some images.

enter image description here

enter image description here

Here is the code I use in App.js

enter image description here

Is there anyone that knows how I can fix this? Much appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里兽 2025-02-19 11:28:09

NetLify不运行像Heroku这样的应用程序服务器,它仅运行静态文件服务器。从您的代码中,您似乎正在尝试提供一个可以连接到的应用程序,并为您提供GraphQL访问。这是在Netlify上不可能的,至少不是直接的。

NetLify当前在NetLify功能中提供的唯一类似服务器的解决方案。但是,默认情况下,这些限制为10秒,并提供一次性数据连接 - 您不能继续使用GraphQL。

因此,如果您的要求是保持GraphQL Server运行(例如,例如Gatsby在Gatsby开发中所做的事情),NetLify不是您的解决方案。如果您希望一次发送数据并添加一些服务器端处理,则可以查看NetLify功能。

Netlify doesn't run a app server like Heroku, it only runs a static file server. From your code, it appears that you're trying to serve a app that you could connect to and provide yourself with GraphQL access. This is not possible on Netlify, at least not directly.

The only server-like solution that Netlify currently provides in Netlify Functions. However, those are limited to 10 sec by default and provide, one-time data connection - not something that you could keep on using for GraphQL.

So if your requirement is to keep the GraphQL server running (for example like what Gatsby does during gatsby develop), Netlify is not the solution for you. If you wish to send the data one-time and add some server-side processing, you can take a look at Netlify Functions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文