NhostClient
NhostClient
Section titled “NhostClient”// Create a new Nhost client from subdomain and region.const nhost = new NhostClient({ subdomain, region })// Create a new Nhost client from individual service URLs (custom domains, self-hosting, etc).const nhost = new NhostClient({ authUrl: 'my-auth-service-url', storageUrl: 'my-storage-service-url', graphqlUrl: 'my-graphql-service-url', functionsUrl: 'my-functions-service-url'})// Create a new Nhost client for local development.const nhost = new NhostClient({ region: 'local', subdomain: 'local' })Parameters
Section titled “Parameters”__namedParameters required NhostClientConstructorParams
| Property | Type | Required | Notes |
|---|---|---|---|
| __namedParameters.adminSecret | string | When set, the admin secret is sent as a header, x-hasura-admin-secret, for all requests to GraphQL, Storage, and Serverless Functions. | |
| __namedParameters.functionsUrl | string | ||
| __namedParameters.storageUrl | string | ||
| __namedParameters.graphqlUrl | string | ||
| __namedParameters.authUrl | string | ||
| __namedParameters.region | string | Project region (e.g. eu-central-1) Project region is not required during local development (when subdomain is localhost) | |
| __namedParameters.subdomain | string | Project subdomain (e.g. ieingiwnginwnfnegqwvdqwdwq) Use localhost during local development | |
| __namedParameters.devTools | boolean | Activate devTools e.g. the ability to connect to the xstate inspector | |
| __namedParameters.autoSignIn | boolean | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with | |
| __namedParameters.autoRefreshToken | boolean | When set to true, will automatically refresh token before it expires | |
| __namedParameters.clientStorage | ClientStorage | Object where the refresh token will be persisted and read locally. | |
| __namedParameters.clientStorageType | ClientStorageType | Define a way to get information about the refresh token and its exipration date. | |
| __namedParameters.refreshIntervalTime | number | Time interval until token refreshes, in seconds | |
| __namedParameters.start | boolean |