Skip to content

ronanyeah/rust-hasura

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust + Hasura Rust

This is an example of a Rust server that functions as a remote schema for Hasura.

It demonstrates:

You can learn more about this stack from this talk.

Package Manager

Cargo

Setup

  • Your Hasura schema must have a table user, with a id column of type uuid, and also a username column of type text.
  • Set an ADMIN_SECRET and a JWT_SECRET on the graphql engine, and share these with the Rust server as environment variables.
  • Use graphqurl to generate schema.json
  • gq $HASURA_ENDPOINT -H "x-hasura-admin-secret: $ADMIN_SECRET" --introspect --format json > ./graphql/schema.json

Start

  • cargo run

Environment Variables

Key Example
PORT 8000
HASURA_ENDPOINT http://127.0.0.1:8080/v1/graphql
ADMIN_SECRET foo
JWT_SECRET {"type":"HS256","key":"3QQ6FD+o0+c7tzQQVfjpMkNDi2yARAAKzQQk8O2IKoxQQ4nF7EdAh8s3TwpHwrdQQ6R"}

Releases

No releases published

Packages

No packages published

Languages