nhost-js-sdk

With the nhost-js-sdk you get easy access to handle auth and storage for your app.

Install nhost-js-sdk with npm

npm install --save nhost-js-sdk

Next, configure your nhost instance with your nhost project.

import nhost from 'nhost-js-sdk';
const config = {
endpoint: 'https://backend-xxxxxxx.nhost.io',
};
nhost.initializeApp(config);
const auth = nhost.auth();
const storage = nhost.storage();
export {
auth,
storage
};

React Native

For React Native you can pass in asyncStorage for nhost to use instead of the default localStorage.

import nhost from 'nhost-js-sdk';
import { AsyncStorage } from 'react-native';
import { BACKEND_ENDPOINT } from '../config';
const config = {
endpoint: 'https://backend-xxxxxx.nhost.io/'
storage: AsyncStorage
};
nhost.initializeApp(config);
const auth = nhost.auth();
const storage = nhost.storage();
export {
auth,
storage
};