Remix.run 不使用 Node.js 作为后端吗?

发布于 2025-01-20 15:25:45 字数 438 浏览 1 评论 0原文

我对 remix.run 感到非常兴奋,但是我真的没有得到一件事。它在对框架的技术解释中说:

当混音在服务器上运行时,它实际上不是服务器。这只是一个提供给实际JavaScript服务器的处理程序。

它是在Web Fetch API而不是Node.js上构建的。这使混音可以在任何node.js服务器中运行,例如vercel,netlify,Architect等,以及cloudflare Workers和deNo部署(例如cloudflare working and demapention)的非node.js环境。

所以..后端是node.js服务器吗?如果没有。。如何在后端执行JS?我认为在上述解释中有点矛盾。

I'm very stoked about Remix.run, but there's one thing I really don't get. In the technical explanation of the Framework it says:

While Remix runs on the server, it is not actually a server. It's just a handler that is given to an actual JavaScript server.

It's built on the Web Fetch API instead of Node.js. This enables Remix to run in any Node.js server like Vercel, Netlify, Architect, etc. as well as non-Node.js environments like Cloudflare Workers and Deno Deploy.

So.. is the backend a Node.js server or not? If not.. how can it execute JS in the backend? I think it a bit contradictory in the above explanation.

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

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

发布评论

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

评论(1

温馨耳语 2025-01-27 15:25:45

Remix 是用许多不同的适配器构建的(不确定这是否是官方术语,但适配器的想法很合适)。这使得 Remix 可以交换其架构的一部分,使 Remix “适合”。这些适配器包的示例包括 remix-vercel、remix-express 等。它们的目的都是将这些平台上的请求/事件的不同接口转换为 Remix 的请求/响应模型(从而获取)。

前面提到的所有适配器都是基于 Node 的环境,但 Remix 也有一些适用于非 Node 环境的适配器。例如,remix-clouflare-workers 是一个适配器,旨在使 Cloudflare Workers 环境与 Remix 良好配合。 Cloudflare Workers 不在 Node 上运行,事实上它甚至不是服务器,而只是由事件触发的 javascript 函数。 Workers 直接在 V8 Javascript 引擎上运行,Chrome 和 Node 使用该引擎运行 JavaScript。

所以是的,Remix 可以作为服务器运行在 NodeJS 环境中,但由于其适配器架构,它也可以为非 NodeJS 环境提供适配器,以及 be(无服务器)功能等。

有趣的是,即使 remix-react 也是一个单独的包(适配器),允许Remix团队(或社区)将来为其他前端框架实现适配器!

Remix is build with a lot of different adapters (not sure if that is the official term, but the idea of adapter is fitting). This allows remix to swap out parts of its architecture to make Remix "fit". Examples of those adapter packages are remix-vercel, remix-express, and so on. They all serve te purpose of converting the different interfaces of the requests/events on those platforms to the request/response model of Remix (thus fetch).

All the previous mentioned adapters are Node-based environments, but Remix also has some adapters for non-node environments. For example remix-clouflare-workers is an adapter designed to make the Cloudflare Workers environment play nice with Remix. Cloudflare Workers are not running on Node, in fact its not even a server but just javascript functions being triggered by events. Workers are running directly on the V8 Javascript Engine, the engine that is used by Chrome and Node to run JavaScript.

So yes, Remix can run in NodeJS environments as a server, but because of its adapter architecture, it can also provide adapters for non NodeJS environments, and be (serverless) functions, etc.

Fun fact, even remix-react is a seperate package (adapter), allowing the Remix team (or community) to implement adapters for other front end frameworks in the future!

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