ui-router-server / connect / createConnectMiddleware
Function: createConnectMiddleware()
ts
function createConnectMiddleware(router, options?): ConnectMiddleware;Defined in: connect.ts:154
Wraps a ServerRouter as Connect middleware. Mount it BEFORE the static layer; the default host serves shells by rewriting req.url and next()ing into it. resolve() is always async (the simulate tier's lazy boundary), which Connect absorbs naturally — with matcher-tier mounts nothing async ever actually runs.
redirect→writeHead(302, { Location }), the request's search MERGED into the verdict's location via mergeSearch (targets that declare their own query keep it — never?a=1?b=2).shell→Link: <mount>; rel="canonical"(the shell is the same representation at every route path), then serveShell.shellwith status (the otherwise projection) → validators stripped, downstream status relabeled, no canonical Link (a 404 is not an alternate representation of the mount root), then serveShell.notFoundwith a mount → serveNotFound (honest 404).notFoundwithout a mount, or a non-navigation request →next().
Parameters
| Parameter | Type |
|---|---|
router | ServerRouter |
options | ConnectAdapterOptions |