简体   繁体   中英

Is Remix.run not using node.js as backend?

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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