API Reference

Server

Server is the shared runtime object behind Reactus rendering. It stores configuration, manifest state, template strings, and the Vite bridge used during development.

Server is the shared runtime object behind Reactus rendering. It stores configuration, manifest state, template strings, and the Vite bridge used during development.

ts
import { Server } from 'reactus';

const server = new Server(Server.configure({
  cwd: process.cwd(),
  production: false
}));

Static method

Server.configure(options)

Merge partial options with Reactus defaults.

ts
const config = Server.configure({
  cwd: process.cwd(),
  clientRoute: '/client'
});

Returns

A frozen ServerConfig object.

Properties

PropertyTypeDescription
loaderServerLoaderFile and module loader.
manifestServerManifestCollection of known document entries.
resourceServerResourceVite integration.
productionbooleanRendering mode flag.
vfsVirtualServerIn-memory file store used during builds and transforms.
pathsfrozen objectAsset, client, page, and optional CSS paths.
routesfrozen objectClient and CSS route prefixes.
templatesfrozen objectClient, document, and page templates.

Method

http(req, res)

Run the Vite middleware stack for a request.

ts
await server.http(req, res);

Use this in development before your own route logic.