Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize the Supabase client with your project URL.
Supabase
import { createClient } from '@supabase/supabase-js'; const supabaseUrl = '[1]'; const supabaseKey = 'your-anon-key'; const supabase = createClient(supabaseUrl, supabaseKey);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a local URL instead of the Supabase project URL.
Using the generic supabase.com URL instead of your project URL.
✗ Incorrect
The Supabase client needs your unique project URL to connect to your database.
2fill in blank
mediumComplete the code to sign up a new user with email and password.
Supabase
const { data, error } = await supabase.auth.[1]({
email: 'user@example.com',
password: 'password123'
}); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using login instead of signUp to create a new user.
Using register or createUser which are not valid Supabase methods.
✗ Incorrect
The method to create a new user is signUp in Supabase auth.
3fill in blank
hardFix the error in the code to fetch data from the 'profiles' table.
Supabase
const { data, error } = await supabase.from('[1]').select('*'); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular 'profile' instead of 'profiles'.
Using incorrect table names like 'users' or 'profile_table'.
✗ Incorrect
The correct table name is 'profiles' as created in Supabase.
4fill in blank
hardFill both blanks to update a user's profile with new data.
Supabase
const { data, error } = await supabase.from('[1]').update({ name: 'Alice' }).[2]('id', 1); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'users' instead of 'profiles' table.
Using 'filter' instead of 'eq' for filtering.
✗ Incorrect
Use 'profiles' table and 'eq' method to filter by id.
5fill in blank
hardFill all three blanks to insert a new row and return the inserted data.
Supabase
const { data, error } = await supabase.from('[1]').insert([{ [2]: 'Bob', [3]: 30 }]).select(); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'users' instead of 'profiles' table.
Using wrong field names like 'username' or 'years'.
✗ Incorrect
Insert into 'profiles' table with fields 'name' and 'age'.