1.0.0 • Published 12 months ago

@nativescript/supabase v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
12 months ago

Nativescript Supabase

npm install @nativescript/supabase

Usage

Database

import {createClient} from '@nativescript/supabase';

const client = createClient('supabaseUrl', 'supabaseKey');

  // Select from table `countries` ordering by `name`
  const response = await client
      .from('countries')
      .select()
      .order('name', ascending: true)
      .execute();
}

Authentication

import {createClient} from '@nativescript/supabase';

const client = createClient('supabaseUrl', 'supabaseKey');

// Sign up user with email and password
const response = await client.auth.signUp('email', 'password');

Storage

import {File as nsFile, knownFolders, path} from '@nativescript/core';
import {createClient} from '@nativescript/supabase';

 const client = createClient('supabaseUrl', 'supabaseKey');
  
  // Create file `example.txt` and upload it in `public` bucket
  const exampleText = path.join(knownFolders.documents().path, 'example.txt');
  const file = nsFile.fromPath(exampleText);
  file.writeTextSync('File content');
  const storageResponse = await client
      .storage
      .from('public')
      .upload('example.txt', exampleText);

Check out the Official Documentation to learn all the other available methods.

Credits

Based on supabase-js

License

Apache License Version 2.0