Skip to content

Sample GraphQL server to show the use of the requested-fields lib.

Notifications You must be signed in to change notification settings

gbaptista/requested-fields-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

requested-fields-demo Maintainability

Sample GraphQL server to show the use of the requested-fields lib. Created with graphql-go and chi.

Setup

dep init
dep ensure
go build
./requested-fields-demo

Schema

schema {
  query: Query
}

type Query {
  user: User
}

type User {
  name: String
  address: Address
}

type Address {
  city: String
  street: String
}

Query

Request:

query {
  user {
    name
    address {
      street
      city
    }
  }
}

Result:

{
  "data": {
    "user": {
      "name": "Harry Potter",
      "address": {
        "street": "4 Privet Drive",
        "city": "Little Whinging"
      }
    }
  }
}

Logs:

2019/02/10 19:52:16 Query.User Fields: [name address]
2019/02/10 19:52:16 User.Address Fields: [street city]
2019/02/10 19:52:16 "POST http://localhost:3000/graphql HTTP/1.1"

About

Sample GraphQL server to show the use of the requested-fields lib.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages