Initialize SDK
HexabaseClient is the root object when operating Hexabase.
Importing HexabaseClient
Import HexabaseClient from @hexabase/hexabase-js
.
import { HexabaseClient } from '@hexabase/hexabase-js';
Initialization of HexabaseClient
To initialize HexabaseClient, use the new
operator. Hexabase is now ready for use.
const client = new HexabaseClient();
Initialization options
The following parameters can be specified when initializing HexabaseClient. All are optional.
Option Name | Description |
---|---|
env | Environment name. If omitted, the production environment settings will be applied. Specifying dev sets the staging environment. |
url | Specify the endpoint URL of the GraphQL API. |
rest | Specify the endpoint URL of the REST API. |
sse | Specify the endpoint URL for PubSub. |
When using Hexabse in a staging environment, initialize it as follows:
const client = new HexabaseClient({
env: 'dev',
});
To customize URLs in detail, initialize it as follows:
const client = new HexabaseClient({
env: 'dev', // The base is a staging environment
url: 'https://api.stg.hexabase.com/graphql', // Customize only the GraphQL endpoint
});