8000 GitHub - aperezg/graphiql: An adapter on GO to serve the GraphiQL in-browser IDE.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

aperezg/graphiql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang GraphiQL

Build Status GoDoc

An utility wrote on Go for using GraphiQL without need to use NPM.

Try the live demo.

Getting started

To install the library, run:

go get -u github.com/ubeep/graphiql

Use GraphiQL on your own server

If you've a GraphQL server on GO and you want to include the GraphiQL on it, it's as simple as this:

package main

import(
	"net/http"
	"github.com/ubeep/graphiql"
)

func main() {
	
	graphiqlHandler, err := graphiql.NewGraphiqlHandler("/graphql")
	if err != nil {
		panic(err)
	}
	
	http.HandleFunc("/graphql", myGraphQLHandler)
	http.Handle("/graphiql", graphiqlHandler)
	http.ListenAndServe(":8080", nil)
}

Use GraphiQL standalone

If you want launch GraphiQL for use on your GraphQL API but you don't want include it in your own project you can launch your own GraphiQL Server:

package main

import(
	"net/http"
	"github.com/ubeep/graphiql"
)

func main() {
	graphiqlHandler, err := graphiql.NewGraphiqlHandler("http://localhost:8080/graphql")
	if err != nil {
    		panic(err)
	}
    	
	
	http.Handle("/graphiql", graphiqlHandler)
	http.ListenAndServe(":4040", nil)
}

Contribute

Contributions are more than welcome, if you are interested please fork this repo and send your Pull Request.

License

MIT License, see LICENSE

About

An adapter on GO to serve the GraphiQL in-browser IDE.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%
0