Using with Hasura
Hasura is a very popular backend solution for rapidly creating GraphQL backends with the use of PostgreSQL, an open-source SQL database.
As of v1.3.0-beta.1
, Hasura provides a relay compatible schema.
#
Setting up HasuraFollow the guide to setting up Hasura in the Hasura docs. Make sure to use a version greater than v1.3.0-beta.1
. The rest of this guide will assume that Hasura is running on the default port of 8080
and that the hasura admin secret is hasura-admin-secret
.
#
Enabling RelayIn the Hasura console, toggle the Relay API on. Note the API endpoint generated. For more information, check out this article by Hasura. This guide will assume that the relay endpoint is hasura-relay-endpoint
.
#
Generating the schema fileRun the following command to generate the schema.graphql file.
For more information, check out the Hasura docs.
#
Configuring the Relay environmentIn a previous section, we'd set up the Relay environment. Continuing on that, in the code below, the lines with comments indicate the changes to be made to connect to Hasura.
#
ConclusionThat's all. Hasura is now set up. You can use the Hasura console to test your queries and integrate them into your app.