Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

updating queries on the homepage

Isaiah Hamiltonddd29b6d3883
diff --git a/apps/www/data/home/api-examples.js b/apps/www/data/home/api-examples.js
index 652cfaad0c5..b7a27801a21 100644
--- a/apps/www/data/home/api-examples.js
+++ b/apps/www/data/home/api-examples.js
@@ -39,58 +39,72 @@ const realtime = supabase
},
{
lang: 'js',
- title: 'Read a record',
- description: 'Get all public rooms and their messages',
- code: `import '@supabase/supabase-js'
-
+ title: 'Create bucket',
+ description: 'Creates a new Storage bucket',
+ code: `import { createClient } from '@supabase/supabase-js'
+
// Initialize
const supabaseUrl = 'https://chat-room.supabase.co'
const supabaseKey = 'public-anon-key'
const supabase = createClient(supabaseUrl, supabaseKey)
-// Get public rooms and their messages
-const publicRooms = await supabase
- .from('rooms')
- .select(\`
- name,
- messages ( text )
- \`)
- .eq('public', true)
+// Create a new bucket
+const { data, error } = await supabase
+ .storage
+ .createBucket('avatars', {
+ public: false,
+ allowedMimeTypes: ['image/png'],
+ fileSizeLimit: 1024
+ })
`,
},
{
lang: 'js',
- title: 'Create a record',
- description: 'Create a new chat room',
+ title: 'Invoke function',
+ description: 'Invoke a Supabase Function',
code: `import { createClient } from '@supabase/supabase-js'
-
+
// Initialize
const supabaseUrl = 'https://chat-room.supabase.co'
const supabaseKey = 'public-anon-key'
const supabase = createClient(supabaseUrl, supabaseKey)
-// Create a new chat room
-const newRoom = await supabase
- .from('rooms')
- .insert({ name: 'Supabase Fan Club', public: true })
- `,
+// Invoke a function
+const { data, error } = await supabase.functions.invoke('hello', {
+ body: { foo: 'bar' }
+})
+ `,
},
{
lang: 'js',
- title: 'Update a record',
- description: 'Update a user',
+ title: 'CRUD a record',
+ description: 'Create, Read, Update and Delete all public rooms and their messages',
code: `import { createClient } from '@supabase/supabase-js'
// Initialize
const supabaseUrl = 'https://chat-room.supabase.co'
const supabaseKey = 'public-anon-key'
const supabase = createClient(supabaseUrl, supabaseKey)
-
+
+// Create a new chat room
+const newRoom = await supabase
+ .from('rooms')
+ .insert({ name: 'Supabase Fan Club', public: true })
+
+// Get public rooms and their messages
+const publicRooms = await supabase
+ .from('rooms')
+ .select(\`
+ name,
+ messages ( text )
+ \`)
+ .eq('public', true)
+
// Update multiple users
const updatedUsers = await supabase
.from('users')
.eq('account_type', 'paid')
.update({ highlight_color: 'gold' })
-`,
+ `,
},
]