Deploy

From the server-side point of view, vite-plugin-ssr is just a server middleware. It's versatile and we can use it any server environment we want.

import { renderPage } from 'vite-plugin-ssr'

// `app` can be any server framework such as Express.js/Fastify/Koa/Hapi/...
app.get('*', async (req, res) => {
  // `renderPage()` can also be used in serverless environments such as
  // Cloudflare Workers and Vercel
  const { httpResponse } = await renderPage({ urlOriginal: req.url })
  res.send(httpResponse.body)
})