parseHost
Tokenize a host header into its hostname/port/app/shop parts.
my-shop.storefront.localhost:443 → { hostname: 'my-shop.storefront.localhost',
port: 443, isDev: true, tld: 'localhost',
app: 'storefront', shop: 'my-shop',
segments: ['my-shop','storefront','localhost'] }
demo.nordcom.store.storefront.localhost → { …, app: 'storefront', shop: 'demo.nordcom.store' }
storefront.localhost → { …, app: 'storefront', shop: null }
localhost → { …, app: null, shop: null }
shop.example.com → { …, isDev: false, tld: null, app: null, shop: null }
Returns null when the input cannot be normalized (empty, leading dot,
etc.) so the caller can short-circuit before destructuring.
Signature
function parseHost(host: string): ParsedHost;Parameters
| Name | Type | Description |
|---|---|---|
host | string |
Related
ParsedHost AppName BuildEnv DevTld Hostname ShopHandle appFromHost isDevelopment