Skip to content

Commit b998720

Browse files
committed
add example deno
1 parent 3dd452e commit b998720

File tree

7 files changed

+142
-147
lines changed

7 files changed

+142
-147
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ jobs:
8787
8888
- name: Run Deno tests
8989
run: |
90-
cd test/deno
91-
deno task test
90+
cd examples/deno
91+
deno task start
9292
9393
- name: Stop Supabase
9494
run: |

examples/deno/deno.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"tasks": {
3+
"start": "deno run --allow-net --allow-env --allow-read main.ts"
4+
}
5+
}

examples/deno/deno.lock

Lines changed: 102 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/deno/main.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { createClient } from 'jsr:@supabase/supabase-js@2'
2+
3+
// Initialize the Supabase client
4+
const supabaseUrl = Deno.env.get('SUPABASE_URL') ?? 'http://localhost:54321'
5+
const supabaseKey =
6+
Deno.env.get('SUPABASE_ANON_KEY') ??
7+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0'
8+
9+
const supabase = createClient(supabaseUrl, supabaseKey)
10+
11+
// Example function to fetch data
12+
async function signUpWithEmailAndPassword() {
13+
try {
14+
const { data, error } = await supabase.auth.signUp({
15+
email: `random${Math.random().toString(36).substring(2, 9)}@example.com`,
16+
password: `random${Math.random().toString(36).substring(2, 9)}`,
17+
})
18+
19+
if (error) {
20+
console.error('Error signing in:', error.message)
21+
throw error
22+
}
23+
24+
console.log('Signed up:', data)
25+
} catch (err) {
26+
console.error('Unexpected error:', err)
27+
throw err
28+
}
29+
}
30+
31+
// Run the example
32+
console.log('Starting Supabase Deno example...')
33+
await signUpWithEmailAndPassword()

test/deno/deno.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/deno/integration.test.ts

Lines changed: 0 additions & 119 deletions
This file was deleted.

test/deno/package.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)