Skip to content

tallstreet/starwarsgraphqlgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

StarWars GraphQL Go

Program starwarsgraphqlgo shows a simple HTTP server that exposes a bare schema and allows you to query simple data via GraphQL

Example:

$ go get github.com/tallstreet/starwarsgraphqlgo
$ starwarsgraphqlgo &
$ curl -g -XPOST 'http://localhost:8080/' --data-binary '{ "query": "{__schema{types{name,description,fields{name}}}}"}'
$ curl -g -XPOST 'http://localhost:8080/' --data-binary '{ "query": "query gary { factions(id: \"2\") {  name, ships { name }  } } "}'
{
	"data": {
		"factions": {
		"name": "Galactic Empire",
		"ships": [
			{
			"name": "Executor"
			},
			{
			"name": "TIE Fighter"
			},
			{
			"name": "TIE Interceptor"
			}
		]
		}
	}
}

Here we see the server showing the available root fields ("schema").

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages