---
url: >-
  https://lit-ui-router.dev/reference/ui-router-server/fetch/interfaces/FetchAdapterOptions.md
---
[ui-router-server](../../index.md) / [fetch](../index.md) / FetchAdapterOptions

# Interface: FetchAdapterOptions\<Args, Decls>

Defined in: [fetch.ts:205](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/fetch.ts#L205)

Host hooks for [createFetchHandler](../functions/createFetchHandler.md): asset IO, which requests get verdicts, delegate handlers, and response states.

## Type Parameters

| Type Parameter | Default type |
| ------ | ------ |
|  `Args` *extends* `unknown`\[] | \[] |
|  `Decls` *extends* [`RouteDeclaration`](../../redirects/interfaces/RouteDeclaration.md) | [`RouteDeclaration`](../../redirects/interfaces/RouteDeclaration.md) |

## Properties

| Property | Type | Description | Defined in |
| ------ | ------ | ------ | ------ |
|  `base?` | `string` | The url path the site is served at, `/` by default. The handler matches each request with the base taken off, so the mount table stays at `/`, returns `null` for a request outside the base, and puts the base back on redirect `Location`s, the canonical `Link` and the shell Request's url. Delegates and `serveResponse` get the original request. Defaults to the router's [base](../../index/interfaces/ServerRouter.md#base); a different value throws. Under a base the router doesn't declare, the handler resolves the base once and every request rejects when a mount already carries it. | [fetch.ts:219](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/fetch.ts#L219) |
|  `delegates?` | [`DelegateHandlers`](../type-aliases/DelegateHandlers.md)<`Args`, `Decls`> | Handlers for the keys states name in [\`delegate\`](../../redirects/interfaces/RouteDeclaration.md#delegate). A request of any method or Accept that matches a delegating state goes to its handler, called with the original request and the arguments the adapter got (`delegates: { ledger: app.fetch }`), so every handler shares one `Args` signature. A typed router requires every key it names at compile time; construction throws when a router from `createServerRouter` names a key missing here. A structural router is checked per request instead, so its delegate verdict throws. Requests outside [shouldHandle](#shouldhandle) only match urls, never a transition, and pass as `null` without matching when the router names no keys (or, for a structural router, when this option is absent). | [fetch.ts:270](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/fetch.ts#L270) |
|  `serveNotFound?` | (`mount`, `request`) => | [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | `Promise`<[`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)> | Serve a mount-owned miss (`notFound` with a mount: the mount owned the pathname but no route matched). The default answers a minimal `text/plain` 404 — override to serve a real 404 page. A `notFound` without a mount is never routed here: the pathname isn't this router's, so the handler returns `null` and the host serves it. | [fetch.ts:243](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/fetch.ts#L243) |
|  `serveResponse?` | [`ServeResponse`](../type-aliases/ServeResponse.md)<`Args`> | Answers the states marked [\`response\`](../../redirects/interfaces/RouteDeclaration.md#response). A GET or HEAD of any Accept that matches one comes here, so an `<img>` reaches its badge; other methods get a 405. A typed router that declares response states requires it at compile time; construction throws when a router from `createServerRouter` declares one and it is absent. A structural router's response verdict throws per request instead. | [fetch.ts:279](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/fetch.ts#L279) |
|  `serveShell` | (`mount`, `request`) => | [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | `Promise`<[`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)> | Serve the mount's shell asset. The adapter hands over a shell Request already rewritten to [shellPath](#shellpath) and, for a status'd shell, already stripped of conditional validators — so the host returns the RAW asset Response (`(mount, request) => env.ASSETS.fetch(request)`) and the adapter owns the status relabel and Link header on the way out. REQUIRED: asset IO is the one thing a runtime-neutral adapter cannot default. | [fetch.ts:235](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/fetch.ts#L235) |
|  `shellPath?` | (`mount`) => `string` | Maps a shell verdict's mount to the pathname the shell Request is built at (default: the mount base itself). The hook for aliased mounts whose shell asset lives under another prefix (e.g. a 404 exhibit that borrows the vanilla app's shell). | [fetch.ts:226](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/fetch.ts#L226) |
|  `shouldHandle?` | (`request`) => `boolean` | Which requests get verdicts. The default is the navigation heuristic the Connect adapter uses (and Vite's HTML fallback mirrors): GET/HEAD requests whose Accept includes `text/html`. Module and asset fetches (`Accept: *​/*`) pass as `null`. Override with `() => true` when the handler runs behind the static layer and should judge everything. Delegating states ignore it: they answer every request that matches them. | [fetch.ts:255](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/fetch.ts#L255) |
