graphQL_sample

command module
v0.0.0-...-7a90fd6 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2018 License: MIT Imports: 6 Imported by: 0

README

graphQL_sample

This repository is simple golang web application for practice of graphQL.

Note: This application don't have database. So application save data to temp memory.

Setup

Please install dep and run following command.

dep init
dep ensure

Run

go run main.go

Sample request data

# fetch userList
$ curl -H 'Content-Type:application/json' -X POST -d '{userList{userId, userName, description, photoURL, email}}' 'http://localhost:8080/graphql'
# => {"data":{"userList":[]}}

# createUser
$ curl -H 'Content-Type:application/json' -X POST -d 'mutation{createUser(userName:"mituba", description: "des", photoURL: "photo", email: "email"){userId, userName, description, photoURL, email}}' 'http://localhost:8080/graphql'
# => {"data":{"createUser":{"description":"des","email":"email","photoURL":"photo","userId":"dcbc6f51-2e0c-4e7a-866a-0fa0b9b3a0a2","userName":"mituba"}}}

# fetch eventList
$ curl -H 'Content-Type:application/json' -X POST -d '{eventList{eventId}}' 'http://localhost:8080/graphql'
# => {"data":{"eventList":[]}}

# createEvent
$ curl -H 'Content-Type:application/json' -X POST -d 'mutation{createEvent(user: {userId: "1", userName:"mituba", description: "des", photoURL: "photo", email: "email"}, eventName: "event", description: "des", location: "loc", startTime: "start", endTime: "end",){eventId, user{userName}}}' 'http://localhost:8080/graphql'
# => {"data":{"createEvent":{"eventId":"550adc55-1cd0-4ea5-a7a3-f1089d89707f","user":{"userName":"mituba"}}}}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
application
domain

Jump to

Keyboard shortcuts

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