API 浏览器
Quasar CLI with Vite - @quasar/app-vite
SSR 准备

我们将使用 Quasar CLI 开发和构建一个 SSR 网站。构建 SPA、移动应用、Electron 应用、PWA 或 SSR 之间的区别仅仅取决于 “quasar dev” 和 “quasar build” 命令中的 “mode” 参数。

¥We’ll be using Quasar CLI to develop and build a SSR website. The difference between building a SPA, Mobile App, Electron App, PWA or SSR is simply determined by the “mode” parameter in “quasar dev” and “quasar build” commands.

为了开发或构建 SSR 网站,我们首先需要将 SSR 模式添加到我们的 Quasar 项目中:

¥In order to develop or build a SSR website, we first need to add the SSR mode to our Quasar project:

$ quasar mode add ssr

如果你想直接开始开发,可以跳过 “quasar 模式” 命令并执行:

¥If you want to jump right in and start developing, you can skip the “quasar mode” command and issue:

$ quasar dev -m ssr

如果缺少 SSR 模式,这将自动添加它。

¥This will add SSR mode automatically, if it is missing.

你的项目文件夹中将出现一个新文件夹(配置 SSR 页面上有详细说明):

¥A new folder will appear in your project folder (which is explained in detail on the Configuring SSR page):

middlewares/
# SSR middleware files
server.js
# (or .ts) SSR webserver