API Routes

Vite-plugin-ssr doesn't implement API Routes by design.

Instead, directly use your server (e.g. Express.js endpoints), or use an RPC implementation such as Telefunc or tRPC.

Make sure to place vite-plugin-ssr's middleware last. (Because vite-plugin-ssr is a catch-all middleware; it would supersede your API middleware if you place it before.)

The vite-plugin-ssr maintainers believe that implementing APIs independently of vite-plugin-ssr is a superior approach.