Setu-TS
    Preparing search index...

    Function createPublicFileHandler

    • Creates a handler that ATTEMPTS to serve a file from a directory, resolving the request path relative to createPublicFileHandler.options.assetsDir. The plugin passes the CLIENT-BUILD ROOT here (the parent of the assets dir, where Vite copies public/) — probing the assets subdir itself missed every public file.

      Returns the served HandlerResult on a hit — including the 400 answer for an undecodable request path — and undefined on a miss so the caller can fall through to the next handler (the SSR catch-all).

      Successful responses carry Cache-Control: public, max-age=0, must-revalidate: root files are not content-hashed, so an immutable year would serve stale content the browser refuses to re-check.

      Parameters

      • options: { assetsDir: string; fs: IFileSystem }

        Configuration

      Returns (ctx: IRequestContext) => Promise<HandlerResult | undefined>

      An attempt handler resolving to a result, or undefined on a miss

      0.2.0