1
1
# ` supabase-js `
2
2
3
- An isomorphic Javascript client for Supabase.
3
+ An isomorphic JavaScript client for Supabase.
4
4
5
- - Documentation: https://supabase.io/docs/client/supabase-client
5
+ ** Documentation:** https://supabase.io/docs/client/supabase-client
6
6
7
7
## Usage
8
8
9
+ First of all, you need to install the library:
10
+
9
11
``` sh
10
12
npm install @supabase/supabase-js
11
13
```
12
14
15
+ Then you're able to import the library and establish the connection with the database:
16
+
13
17
``` js
14
18
import { createClient } from ' @supabase/supabase-js'
15
19
@@ -19,19 +23,26 @@ const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key
19
23
20
24
### UMD
21
25
22
- You can now use plain ` <script> ` s to import supabase-js from CDNs, like
26
+ You can now use plain ` <script> ` s to import supabase-js from CDNs, like:
27
+
28
+ ``` html
29
+ <script src =" https://cdn.jsdelivr.net/npm/@supabase/supabase-js" ></script >
30
+ ```
31
+ or even:
23
32
24
- ` <script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script> `
25
- or
26
- ` <script src="https://unpkg.com/@supabase/supabase-js"></script> ` .
33
+ ``` html
34
+ < script src = " https://unpkg.com/@supabase/supabase-js " ></ script >
35
+ ```
27
36
28
37
Then you can use it from a global ` supabase ` variable:
29
38
30
39
``` html
31
40
<script >
32
- const { createClient } = supabase
33
- supabase = createClient (' https://xyzcompany.supabase.co' , ' public-anon-key' )
34
- ...
41
+ const { createClient } = supabase
42
+ const _supabase = createClient (' https://xyzcompany.supabase.co' , ' public-anon-key' )
43
+
44
+ console .log (' Supabase Instance: ' , _supabase);
45
+ // ...
35
46
</script >
36
47
```
37
48
0 commit comments