A sample Next.js app using Zeit's SWR React Hooks to make GraphQL Queries/Mutations/Subscriptions
This is a sample app demonstrating usage of useSWR
, mutate
and trigger
of SWR
library with a Hasura GraphQL API. The app uses native websockets for implementing GraphQL subscriptions on the client.
Click on the following button to deploy GraphQL engine on Hasura Cloud including Postgres add-on or using an existing Postgres database:
Open the Hasura console
Click on the button "Launch console" to open the Hasura console.
Create table users
Head to the Data
tab and create a new table called users
with columns:
id (text), name (text), created_at (timestamp now()).
Try out a GraphQL Query
query {
users {
id
name
created_at
}
}
Deploy your own SWR project with ZEIT Now.
Install it and run:
yarn
yarn dev
# or
npm install
npm run dev
Deploy it to the cloud with now (download)
now