static

package
v0.0.2-0...-4661924 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

README

This package uses https://github.com/GeertJohan/go.rice to embed the static files within the Go binary.

Install with:

go get github.com/GeertJohan/go.rice/rice

Generate the new rice-box.go:

go generate

Documentation

Overview

Code generated by rice embed-go; DO NOT EDIT.

Index

Constants

View Source
const (
	MIME_TYPE_CSS  = "text/css"
	MIME_TYPE_HTML = "text/html"
	MIME_TYPE_JS   = "application/javascript"
	MIME_TYPE_JSON = "application/json"
	MIME_TYPE_SVG  = "image/svg+xml"
)
View Source
const IndexFilename = "graphiql.html"

Variables

This section is empty.

Functions

func RegisterStaticRoutes

func RegisterStaticRoutes(router *mux.Router, protocol, network, apiKey, jwtIssuerURL string, predfinedGraphqlExamples []*GraphqlExample) error

RegisterStaticRoutes registers all GraphiQL static route enabling traffic of `/graphiql` paths. The `predfinedGraphqlExamples` are used to prefill the GraphQL history for the specified protocol and network.

The `jwtIssuerURL` is used to configure the `client-js` library so we are able to easily fetch authentication tokens.

Types

type GraphqlDocument

type GraphqlDocument string

func (GraphqlDocument) MarshalJSON

func (g GraphqlDocument) MarshalJSON() ([]byte, error)

type GraphqlExample

type GraphqlExample struct {
	Label string `json:"label"`
	// Document represents the GraphQL query to perform, serialized as `query` because it's what
	// GraphiQL uses under the hood, so JSON-wise, we respect the name.
	Document GraphqlDocument `json:"query"`

	// Variables represents the GraphQL variables that should be used to populated the variables box
	// in GraphiQL. The `json.RawMessage` is used so we keep control of the order of variables. The
	// pretty-printing is done client client side by our helper script
	Variables GraphqlVariablesByNetwork `json:"variables"`
}

GraphqlExample represents an history example that should be pre-filled in the History tab of the GraphiQL web interface.

type GraphqlVariablesByNetwork

type GraphqlVariablesByNetwork map[string]json.RawMessage

func (GraphqlVariablesByNetwork) MarshalJSON

func (v GraphqlVariablesByNetwork) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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