Skip to content

Utils

Url

This utility function takes a request and returns the host, protocol, and baseUrl. It also considers the forwarded CloudFront headers for the host and protocol.

import { url } from '@pit-shared/remix-runtime/utils'

export async function loader({ request }: LoaderFunctionArgs) {
    const { host, protocl, baseUrl } = url(request)
    // ...
}

Platform

This util function takes a request and returns the currently used Statista platform.

import { platform } from '@pit-shared/remix-runtime/utils'

export async function loader({ request }: LoaderFunctionArgs) {
    const currentPlatform = platform(request)

    // ...
}

i18n

This function is a helper to indicate i18n keys.

It helps make sure that translation key exists on the server.

i18n`YOUR_KEY`