Function buildAstraEndpoint

  • Overview

    Simple utility function to build an Astra endpoint from a database ID and region.

    Useful if you're trying to use DataAPIClient.db or something along those lines, which require a full endpoint URL, but you only have an ID and region to work with.

    Parameters

    • id: string
    • region: string
    • env: "dev" | "prod" | "test" = 'prod'

    Returns string

    Example

    import { buildAstraEndpoint } from '@datastax/astra-db-ts';

    // 'https://<id>-<region>.apps.astra.datastax.com'
    const endpoint = buildAstraEndpoint('<id>', '<region>');