Skip to main content

Getting Started

Installing​

You can install aircampi's database via NPM, Yarn or CDN.

NPM:

  npm install @aircampi/database

Yarn:

  yarn add @aircampi/database

CDN:

  <script src="https://cdn.jsdelivr.net/npm/@aircampi/database"/>

//or

<script src="https://unpkg.com/@aircampi/database"/>

Find the source code on GitHub.

Initializing​

There are 2 way to initialize new client.

Using createClient():


import { createClient } from '@aircampi/database'

// Create a client for interacting with your database stack

const db = createClient({
domain: '<YOUR_DOMAIN>',
client_id: '<YOUR_CLIENT_ID>'
})

Using Client object


import { Client } from '@aircampi/database';

const db = new DatabaseClient({
domain: '<YOUR_DOMAIN>',
client_id: '<YOUR_CLIENT_ID>'
});

//if you do this, you'll need to get list of databases

try {
await db.getDatabases();
} catch (error) {
if (error.error !== 'login_required') {
throw error;
}
}