Skip to content

hasura/graphql-example-apps

Repository files navigation

example-apps

How to use:

  1. Create your heroku app without an access-key
  2. Initialize directory for Hasura GraphQL Engine
hasura init <app-name>
  1. cd into and edit config.yaml to update the endpoint
  2. Run pg_dump to dump the required schemas
pg_dump -h host -d database -U user --attribute-inserts -n schema1,schema2 > migrations/1_init.up.sql
  1. Export metadata by running:
hasura metadata export
  1. Commit all your changes and push to git.
  2. Add accounts@hasura.io as collaborator (Important)
heroku access:add accounts@hasura.io --app <app-name>

Buildbot Workflow (this will happen automatically every 30mins):

  1. Clone the examples-apps repo
  2. Reset postgresql database by running:
heroku pg:reset --app <app-name> --confirm <app-name>
  1. Restart the app so that graphql-engine is initialized
heroku restart --app <app-name>
  1. Apply the migrations by running:
hasura migrate apply
  1. Apply the metadata by running:
hasura metadata apply

Optional files:

  • A README that describes your app
  • A queries.graphql file that lists your sample GraphQL queries that GraphiQL will automatically be loaded with
# Insert author
mutation {
  insert_author(objects: [{name: "natwarlal"}] {
    returning {
      id
    }
  }
}

# Query author
query {
  author {
    id
    name
  }
}

What is the point?

  • A script will refresh all the databases every 30mins for all the example apps (it will run the migrations in the migrations directory)
  • This way you can safely share the Hasura GraphQL engine link with whoever and put it wherever you want, like in your blogpost or on the Hasura website or in a forum or on quora

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published