Skip to content

ui-router-server / connect / ConnectAdapterOptions

Interface: ConnectAdapterOptions

Defined in: connect.ts:55

Properties

PropertyTypeDescriptionDefined in
serveNotFound?(mount, req, res, next) => voidServe 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 middleware always passes it through untouched.connect.ts:82
serveShell?(mount, req, res, next) => voidServe the mount's shell. The default rewrites req.url to shellPath and next()s into the downstream static layer. By the time this runs the adapter has already done the status'd-shell mechanics: request validators stripped and the response relabeled to the verdict's status — a host override only owns the asset IO.connect.ts:69
shellPath?(mount) => stringMaps a shell verdict's mount to the path the default serveShell rewrites req.url to (default: the mount base itself). The hook for aliased mounts whose shell lives under another prefix.connect.ts:61
shouldHandle?(req) => booleanWhich requests get verdicts. The default is the navigation heuristic connect-history-api-fallback established (and Vite's own HTML fallback mirrors): GET/HEAD requests whose Accept includes text/html. Module and asset fetches (Accept: *​/*) pass through untouched — essential under Vite, where a mount's module URLs live on the same paths as its routes. Override with () => true when the middleware sits behind the static layer and should judge everything.connect.ts:97