部署到Apollo GraphQl / Express从任何目录中转到Vercel?

发布于 2025-02-03 21:58:00 字数 749 浏览 2 评论 0 原文

本文中的教程作品:

但是,服务器输入点必须在 api/index中。 JS 如下所示:

# create the `api` folder, and the server entry point
mkdir api
touch api/index.js

...和在 vercel.json 中:

{
  "rewrites": [{ "source": "/(.*)", "destination": "/api" }]
}

但是,如果我尝试将 index.js 移动到任何其他目录,则Vercel将根本不执行JavaScript,而只需在浏览器中显示RAW JAVASCRIPT即可。

您如何移动服务器入口点并仍然告诉Vercel正确执行它?

另外,我尝试直接联系文章作者(StéphaneP。péricat),但我无法在任何地方找到他的联系信息(只有Github,Twitter,Mediver等)

The tutorial in this article works:

https://medium.com/@sppericat/how-to-setup-an-apollo-graphql-server-on-vercel-cc3f2dd72b3e

However, the server entry point must be in api/index.js as shown here:

# create the `api` folder, and the server entry point
mkdir api
touch api/index.js

...and in vercel.json:

{
  "rewrites": [{ "source": "/(.*)", "destination": "/api" }]
}

However, if I try to move index.js to any other directory, then Vercel will not execute the Javascript at all and just show the raw Javascript in the browser.

How do you move the server entry point and still tell Vercel to execute it properly?

Also, I've tried to contact the article author (Stéphane P. Péricat) directly, but I'm unable to find his contact info anywhere (just profiles like Github, Twitter, Medium, etc.)

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文