Introduction to FaunaDB's GraphQL support

InstructorChris Biscardi

Share this video with your friends

Send Tweet

FaunaDB has native support for a GraphQL API backed by FQL. In this video we'll cover the limitations, importing a GraphQL schema, and executing our first mutations and queries.

type Todo {
    title: String!
    completed: Boolean
}

type Query {
    allTodos: [Todo!]
    todosByCompletedFlag(completed: Boolean!): [Todo!]
}
mutation CreateTodo {
  createTodo(data: {
    title: "Finish Video on GraphQL"
  }) {
    _id
    completed
  }
}
mutation CreateTodo {
  createTodo(data: {
    title: "Add Second Todo",
    completed: false
  }) {
    _id
    completed
  }
}
mutation UpdateTodo {
  updateTodo (
    id: "245273222698762765"
    data: {
      title: "A Different Todo",
      completed: false
    }) {
    title
    completed
  }
}
query AllTodosQuery {
  allTodos {
    data { _id title completed }
  }
}
query AllTodosQuery {
  todosByCompletedFlag(completed: false) {
    data {
      _id
      title
    }
  }
}
Samuel Suther
~ 5 years ago

Nice explanation, straight forward without overhead of Information. Enjoyed to see it.