Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.04 KB

GRAPHQL.md

File metadata and controls

28 lines (20 loc) · 1.04 KB

Apollo GraphQL

Steps to set up graphQL in supabase:

  1. Create your tables in supabase.
  2. Link the related fields.
  3. Create a public user table and update the handle_new_user() function.
  4. Go to the SQL console and run: select graphql.rebuild_schema();
  5. Go to Apollo Studio and create a development Graph.
  6. Set the apiKey: and Content-Type: headers.
  7. The Schema will load automatically.
  8. Copy past the queries you need into your project 🍾

Using multiple endpoints

The <ApolloProvider> takes onw client and makes it available when calling the hooks. To use a second endpoint, define a separate client and pass it as option argument to the hooks. See [docs]{https://www.apollographql.com/docs/react/api/react/hooks/#usequery}

SQL hacqs

We want a like or dislike to be unique. So with this little hack, the user can only give one like per NFT:

alter table "Like"
add constraint uq_Person unique(user_id, nft_id);

🤓