部署
本页内容

部署

简介

React Router 可以通过两种方式部署

  • 全栈托管
  • 静态托管

官方的 React Router 模板 可以帮助你引导应用程序,或用作你自己的应用程序的参考。

部署到静态托管时,你可以像部署任何其他使用 React 的单页面应用程序一样部署 React Router。

模板

运行 create-react-router 命令后,请确保遵循 README 中的说明。

Node.js with Docker

npx create-react-router@latest --template remix-run/react-router-templates/default
  • 服务器端渲染
  • Tailwind CSS

容器化应用程序可以部署到任何支持 Docker 的平台,包括

  • AWS ECS
  • Google Cloud Run
  • Azure Container Apps
  • Digital Ocean App Platform
  • Fly.io
  • Railway

Node with Docker (自定义服务器)

npx create-react-router@latest --template remix-run/react-router-templates/node-custom-server
  • 服务器端渲染
  • Tailwind CSS
  • 自定义 express 服务器以获得更多控制权

容器化应用程序可以部署到任何支持 Docker 的平台,包括

  • AWS ECS
  • Google Cloud Run
  • Azure Container Apps
  • Digital Ocean App Platform
  • Fly.io
  • Railway

Node with Docker and Postgres

npx create-react-router@latest --template remix-run/react-router-templates/node-postgres
  • 服务器端渲染
  • 使用 Drizzle 的 Postgres 数据库
  • Tailwind CSS
  • 自定义 express 服务器以获得更多控制权

容器化应用程序可以部署到任何支持 Docker 的平台,包括

  • AWS ECS
  • Google Cloud Run
  • Azure Container Apps
  • Digital Ocean App Platform
  • Fly.io
  • Railway

Vercel

npx create-react-router@latest --template remix-run/react-router-templates/vercel
  • 服务器端渲染
  • Tailwind CSS

Cloudflare Workers w/ D1

npx create-react-router@latest --template remix-run/react-router-templates/cloudflare-d1
  • 服务器端渲染
  • 使用 Drizzle ORM 的 D1 数据库
  • Tailwind CSS

Cloudflare Workers

npx create-react-router@latest --template remix-run/react-router-templates/cloudflare
  • 服务器端渲染
  • Tailwind CSS

Netlify

npx create-react-router@latest --template remix-run/react-router-templates/netlify
  • 服务器端渲染
  • Tailwind CSS
文档和示例 CC 4.0
编辑