menu
Menu
Mobify DevCenter
search_icon_focus

Ssr Server

progressive-web-sdk/dist/utils/ssr-server

getAssetUrl(path)

Get the URL that should be used to load an asset from the bundle.

This function is provided for use in UPWAs.

Import
import { getAssetUrl } from 'progressive-web-sdk/dist/utils/ssr-server

Returns:

string

ParameterTypeDescription
pathstringthe path to the asset (relative to the build directory)

getHashForString(text)

Given a string, return a hash for that string. The hash is usable as an etag, or any other context where a summary hash of a string is required.

Import
import { getHashForString } from 'progressive-web-sdk/dist/utils/ssr-server

Returns:

string - the hash of that string, in hexadecimal

ParameterTypeDescription
textstringthe string to be hashed

parseCacheControl(value)

Perform limited parsing of a Cache-Control header value, to extract the s-maxage and max-age values and return them.

Import
import { parseCacheControl } from 'progressive-web-sdk/dist/utils/ssr-server

Returns:

Object - with ‘max-age’ and ‘s-maxage’ properties mapped to String or undefined values.

ParameterTypeDescription
valueStringthe value to parse