AssetServerOptions
AssetServerOptions
The configuration options for the AssetServerPlugin.
Signature
interface AssetServerOptions {
route: string;
assetUploadDir: string;
assetUrlPrefix?: string | ((ctx: RequestContext, identifier: string) => string);
previewMaxWidth?: number;
previewMaxHeight?: number;
presets?: ImageTransformPreset[];
namingStrategy?: AssetNamingStrategy;
previewStrategy?: AssetPreviewStrategy;
storageStrategyFactory?: (
options: AssetServerOptions,
) => AssetStorageStrategy | Promise<AssetStorageStrategy>;
cacheHeader?: CacheConfig | string;
}
Members
route
string
assetUploadDir
string
assetUrlPrefix
string | ((ctx: RequestContext, identifier: string) => string)
The complete URL prefix of the asset files. For example, “https://demo.vendure.io/assets/". A function can also be provided to handle more complex cases, such as serving multiple domains from a single server. In this case, the function should return a string url prefix.
If not provided, the plugin will attempt to guess based off the incoming request and the configured route. However, in all but the simplest cases, this guess may not yield correct results.
previewMaxWidth
number
1600
previewMaxHeight
number
1600
presets
ImageTransformPreset[]
namingStrategy
previewStrategy
storageStrategyFactory
( options: AssetServerOptions, ) => AssetStorageStrategy | Promise<AssetStorageStrategy>
() => LocalAssetStorageStrategy
cacheHeader
Cache-Control
directive for response to control caching in browsers and shared caches (e.g. Proxies, CDNs).
Defaults to publicly cached for 6 months.