# `@lazarv/react-server/node`

Mount the runtime inside an existing Node.js HTTP server (Express, Fastify, NestJS, raw `http`). Used in middleware mode and custom server setups.

## Functions

### `reactServer`

```ts
function reactServer(options?: ReactServerOptions, initialConfig?: Record<string, any>): Promise<{
    middlewares: NodeMiddleware;
}>;
function reactServer(root?: string, options?: ReactServerOptions, initialConfig?: Record<string, any>): Promise<{
    middlewares: NodeMiddleware;
}>;
```

Use \@lazarv/react-server as a middleware in a Node.js server.

**Parameters**

- `options` — Options for the server, same as the options for the react-server CLI command
- `initialConfig` — Initial configuration for the application

## Interfaces

### `ReactServerOptions`

```ts
interface ReactServerOptions {
    outDir?: string;
    cors?: boolean;
    origin?: string;
    https?: boolean;
    host?: string;
    port?: number;
    trustProxy?: boolean;
}
```

## Types

### `NodeMiddleware`

```ts
type NodeMiddleware = (req: import("http").IncomingMessage, res: import("http").ServerResponse, next?: (err?: any) => void) => any;
```
