⚠️ This lesson is retired and might contain outdated information.

Set up a GraphQL Backend with Hasura and Docker

Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 2 years ago

Use Hasura, an open source GraphQL engine to setup a backend.

You need to have Docker installed. You can install from the Docker website.

Instructor: [0:00] Let's start with a folder for our API. Then we need to cd into this folder and create a Docker Compose file. This is where our Docker configuration is just going to leave in and would specify images for this particular API we're building inside this composed file.

[0:21] Let's edit this file. Basically, what I'm going to do now is to paste this configuration here. What is going on is that I have a Postgres database which uses this password to set up database and connect to it.

[0:39] I have a GraphQL engine which is based off a Hasura GraphQL engine and then it's exposed on port 8080. At the end of the day, when we visit port 8080 we should have access to our API or rather our GraphQL API. Then we're seeing that it depends on the Postgres database it created, and then uses all these environmental variables to set itself up.

[1:03] For example, it's using this database URL to create a connection to the Postgres image we set up before setting up the GraphQL engine. Now I'm going to save this. Once I save this and run Docker Compose up...

[1:26] Now we have our backend set up. If you go to the port I showed you earlier which is the localhost:8080 port and then hit Enter, you should see that we have a GraphQL engine running here. We can basically start doing things like running queries, creating imitations, creating tables and databases, and so on.

egghead
egghead

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today