Skip to content

Commit

Permalink
Updats for new v1/graphql endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
dthyresson committed Mar 28, 2022
1 parent 0987aca commit 9a1ead5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ yarn workspace app dev

### Synchronize the GraphQL schema

Note: You need to call `graphql.rebuild_schema()` manually to synchronize the GraphQL schema with the SQL schema after altering the SQL schema.
Note: You need to call `select graphql.rebuild_schema()` manually to synchronize the GraphQL schema with the SQL schema after altering the SQL schema.

#### Manage Schema with dbmate

Expand Down Expand Up @@ -132,9 +132,9 @@ See: [`./graphql/schema/schema.graphql`](./graphql/schema/schema.graphql)

See: [`./graphql/queries/`](./graphql/queries/)

Use: `https://mvrfvzcivgabojxddwtk.supabase.co/rest/v1/rpc/graphql`
Use: `https://mvrfvzcivgabojxddwtk.supabase.co/graphql/v1`

Note: Needs headers
> Note: Needs headers
```
Expand All @@ -143,6 +143,28 @@ apiKey: <supabase_anon_key>
```

## GraphiQL

GraphiQL is an in-browser IDE for writing, validating, and testing GraphQL queries.

Visit `http://localhost:3000/api/graphiql` for the [Yoga GraphiQL Playground](https://www.graphql-yoga.com/docs/features/graphiql) where you can experiment with queries and mutations.

> Note: Needs headers
```
Content-Type: application/json
apiKey: <supabase_anon_key>
```

> Note: In order for the RLS policies authenticate you. you've have to pass an authorization header:
```
authorization: Bearker <access_token>
```

### Ranked Feed

```gql
Expand Down
2 changes: 1 addition & 1 deletion app/lib/urql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function UrqlProvider(props: { children: React.ReactNode }) {

const [client] = React.useState(function createUrqlClient() {
return createClient({
url: `${process.env.NEXT_PUBLIC_SUPABASE_URL!}/rest/v1/rpc/graphql`,
url: `${process.env.NEXT_PUBLIC_SUPABASE_URL!}/graphql/v1`,
fetchOptions: function createFetchOptions() {
return { headers: getHeaders() };
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/fetchGraphQLSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ console.log(
)
);

fetchGraphQLSchema(`${process.env.SUPABASE_URL}/rest/v1/rpc/graphql`, {
fetchGraphQLSchema(`${process.env.SUPABASE_URL}/graphql/v1`, {
readable: true,
}).then((schema) => {
fs.writeFileSync(filePath, schema, "utf-8");
Expand Down

0 comments on commit 9a1ead5

Please sign in to comment.