example-graphql-query

command module
v0.0.0-...-9433463 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2016 License: MIT Imports: 1 Imported by: 0

README

Example GraphQL Query

For example on GrahpQL Query object with Golang.

Usage

For using this example you may need to installed Golang compiler on your machine, and running following these commands.

$ git clone https://github.com/nomkhonwaan/example-graphql-query.git
$ cd /path/to/example-graphql-query

For running directly use this command.

$ go run main.go

And if you want to compile before running it, just using these commands.

$ go build -o graphql-server main.go
$ ./graphql-server

Query via cURL

For using the GraphQL server via cURL like this.

Retrieve people

$ curl -H "Content-Type: application/graphql" \
       -d "{ \
             people { \
               id \
               email \
             } \
           }" \
       http://localhost:8080/graphql

Retrieve people by "gender"

$ curl -H "Content-Type: application/graphql" \
       -d "{ \
             people(gender: \"Male\") { \
               id \
               email \
               gender \
             } \
           }" \
       http://localhost:8080/graphql

Query via Postman

Import this collection to your Postman application https://www.getpostman.com/collections/6c5f187d94244a71e955

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL