Examples

GraphQl Hasura subscriptions Example

Check the example

Configuration

  • Go to: https://hasura.io/learn/graphql/graphiql

You will need to complete a simple signup form (just mail and password) to get access to the GraphiQL interface, and obtain an access token.

  • Set the authorization header, using the token you obtained from the previous step, replace Secret with your token:
1
2
3
4
5
6
```typescript
const hasura = introspect.graphql({
apiNamespace: 'hasura',
url: 'https://hasura.io/learn/graphql',
headers: (builder) => builder.addStaticHeader('Authorization', 'Secret'),
});

Getting started

1
npm install && npm start

Check results

1
curl -N http://localhost:9991/operations/Users
1
curl -N http://localhost:9991/operations/Todo

SSE output

1
curl -N http://localhost:9991/operations/Users\?wg_sse\=true

Playground

Use https://hasura.io/learn/graphql/graphiql to add new users and todos, and explore schema. Add new operations to the .wundergraph/operations folder and run npm start to see the results.

Was this article helpful to you?
Provide feedback

Edit this page