Skip to content

dscx/GraphQL-Relay-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample GraphQL Server using Relay

Setup

1. Install dependencies

$ yarn

2. Run the app

$ node index.js

http://localhost:3000/graphql — Graphiql UI

Sample Queries

Video Count

{
 videos {
 	totalCount
 } 
}

First Video

{
  videos(first:1) {
    edges {
      node {
        id
      }
    }
  }
}

Last Video

{
  videos(last:1) {
    edges {
      node {
        id
      }
    }
  }
}

All Videos

{
  videos {
    edges {
      node {
        title,
        duration,
        released,
        id
      }
    }
  }
}

Add Video

mutation addVideoQuery($input: AddVideoInput!) {
  createVideo(input: $input) {
    video {
      title
    }
  }
}

/* Query Variables */

{
  "input": {
   	"title": "Teenage Mutant Ninja Video",
    "duration": 400,
    "released": true,
    "clientMutationId": "ldrm"
  }
}

About

GraphQL with Relay demo Express server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published