@metreeca/gate - v0.12.0
    Preparing search index...

    Function client

    • Serves a browser client.

      Navigation requests receive the client's entry page whatever their path, so that client-side addresses survive a reload. Other requests receive the client's static assets, or fall through to the next handler if no asset matches.

      A navigation request is a GET or HEAD request that ranks text/html first among its accepted media types. Wildcards do not count: a request that ranks a wildcard or any other media type first always reaches the resource it names, and never receives the entry page in its place, even if it targets a client-side address.

      Every response is marked as varying by Accept, including the responses of handlers a request falls through to. HTTP caches then keep the entry page apart from the other representations of the same address.

      Parameters

      • path: string

        The path of the client's entry page if it ends in .html, or else of a folder holding the entry page as index.html; relative paths are resolved against the working directory, and static assets are served from the folder holding the entry page, under their relative paths within that folder

      Returns RequestHandler

      A handler serving the client, to be mounted ahead of other routes so that navigation requests reach it first