# @askrjs/vite/server

> Published API exports for @askrjs/vite/server.

Source: [https://askrjs.com/docs/reference/api/vite/server](https://askrjs.com/docs/reference/api/vite/server)

Status: stable. Packages: @askrjs/vite/server.

**Published packages are authoritative.** Examples may lag behind a published contract. When guidance differs, verify the exports and TypeScript declarations in your installed package, then file an issue.

## Exports

This entrypoint publishes 12 exports from the declarations shipped by @askrjs/vite.

### `ASKR_APP_MARKER`

```ts
ASKR_APP_MARKER: "<!--askr-app-->"
```

Placeholder marker in `index.html` replaced with the rendered app fragment.

### `ASKR_HEAD_MARKER`

```ts
ASKR_HEAD_MARKER: "<!--askr-head-->"
```

Placeholder marker in `index.html` replaced with rendered `<head>` content.

### `ASKR_SERVER_MODULE_ID`

```ts
ASKR_SERVER_MODULE_ID: "virtual:askr-server"
```

Virtual module id that resolves to the generated server document app.

### `AskrDocumentOptions`

```ts
AskrDocumentOptions: any
```

Options for composing a rendered Askr fragment into the HTML document.

- `telemetry`: telemetry?: ViteTelemetry;

### `askrServer`

```ts
askrServer: (options: AskrServerOptions) => AskrServerPlugin
```

Create the Vite plugin that serves Askr's server-rendered document during
development and generates the {@link ASKR_SERVER_MODULE_ID} virtual module
that composes the built server app with the HTML document.

### `AskrServerOptions`

```ts
AskrServerOptions: any
```

Options for {@link askrServer}.

- `entry`: Path to the server entry module, resolved relative to the Vite root.

- `exportName`: Named export on `entry` providing the `ServerApp`. Defaults to `"app"`, falling back to the default export.

- `indexHtml`: Path to the HTML document template, resolved relative to the Vite root. Defaults to `"index.html"`.

### `AskrServerPlugin`

```ts
AskrServerPlugin: any
```

Portable public identity for the server integration plugin.

- `name`: readonly name: "askr:server";

### `composeAskrDocumentResponse`

```ts
composeAskrDocumentResponse: (response: Response, transformedDocument: string, options?: AskrDocumentOptions) => Promise<Response>
```

Compose an Askr fragment response into the full `transformedDocument` HTML,
streaming the fragment's body between the document prefix and suffix.
Non-fragment responses are returned unchanged.

### `composeAskrHead`

```ts
composeAskrHead: (document: string, head: string, lang?: string, dir?: string) => string
```

Replace the {@link ASKR_HEAD_MARKER} in `document` with normalized `head`
markup, and patch the `<html>` tag's `lang`/`dir` attributes when given.

### `createDocumentApp`

```ts
createDocumentApp: (app: ServerApp, transformedDocument: string, options?: AskrDocumentOptions) => ServerApp
```

Wrap `app` so every response is composed into `transformedDocument` via
{@link composeAskrDocumentResponse}.

### `insertAskrFragment`

```ts
insertAskrFragment: (document: string, fragment: string) => string
```

Replace the single {@link ASKR_APP_MARKER} in `document` with `fragment`.

### `isAskrFragment`

```ts
isAskrFragment: (response: Response) => boolean
```

Whether `response` carries the `askr-fragment=1` content-type marker.

## Documentation navigation

[Previous](https://askrjs.com/docs/reference/api/vite/root/index.md) | [Next](https://askrjs.com/docs/reference/api/vite/image/index.md)
