StaticRoute.directory constructor

StaticRoute.directory(
  1. Directory root, {
  2. CacheBustingConfig? cacheBustingConfig,
  3. CacheControlFactory cacheControlFactory = _defaultFactory,
})

Use StaticRoute.directory to serve everything below a given root.

Use cacheControlFactory to customize what CacheControlHeader to return for a given asset. Default is to leave caching behavior to client side heuristics.

Implementation

factory StaticRoute.directory(
  Directory root, {
  CacheBustingConfig? cacheBustingConfig,
  CacheControlFactory cacheControlFactory = _defaultFactory,
}) {
  return StaticRoute._(
    StaticHandler.directory(
      root,
      cacheBustingConfig: cacheBustingConfig,
      cacheControl: cacheControlFactory,
    ).asHandler,
  );
}