Giter VIP home page Giter VIP logo

graphql-with-absinthe-on-phoenix's Introduction

GraphQL with Absinthe on Phoenix

A guide teaching how to use Query, Dataloader, Mutation, Subscription and Authentication with GraphQL using Absinthe on Phoenix.

Read the article at:

Setup

# clone the project
git clone [email protected]:wbotelhos/graphql-with-absinthe-on-phoenix.git

# access the project
cd graphql-with-absinthe-on-phoenix

# installs the dependencies
mix deps.get

# creates the database
mix ecto.setup

# run the server
mix phx.server

# open the browser
open localhost:4000

GraphQL Queries

Books:

{
  books(limit: 2) {
    id
    name
    position
    verses(limit: 2) {
      id
      chapter
      number
      body
    }
  }
}

Book:

{
  book(id: 1) {
    id
    name
    position
    verses(limit: 2) {
      id
      chapter
      number
      body
    }
  }
}

Create Book:

mutation {
  createBook(name: "Book Name", position: 4) {
    id
    name
    position
  }
}

Create Book (Nested):

mutation {
  createBook(name: "Números", position: 4, verses: [{chapter: 1, number: 1, body: "No segundo ano..."}, {chapter: 1, number: 2, body: "Levantai o censo..."}]) {
    id
    name
    position
    verses {
      body
      chapter
      id
      number
    }
  }
}

Signup:

mutation {
  signup(email: "[email protected]", password: "password") {
    token
    user {
      email
    }
  }
}

Signin:

mutation {
  signin(email: "[email protected]", password: "password") {
    token
    user {
      email
    }
  }
}

graphql-with-absinthe-on-phoenix's People

Contributors

wbotelhos avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.