playground

package
v1.54.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 6 Imported by: 3

Documentation

Overview

Package playground is a http.Handler hosting the GraphQL Playground application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// PathPrefix is a prefix you intend to put in front of all handlers
	PathPrefix string
	// PlaygroundPath is the Path where the playground website should be hosted
	PlaygroundPath string
	// GraphqlEndpointPath is the Path where the http Handler for synchronous (Query,Mutation) GraphQL requests should be hosted
	GraphqlEndpointPath string
	// GraphQLSubscriptionEndpointPath is the Path where the http Handler for asynchronous (Subscription) GraphQL requests should be hosted
	GraphQLSubscriptionEndpointPath string
}

Config is the configuration Object to instruct ConfigureHandlers on how to setup all the http Handlers for the playground

type HandlerConfig

type HandlerConfig struct {
	// Path is where the handler should be hosted
	Path string
	// Handler is the http.HandlerFunc that should be hosted on the corresponding Path
	Handler http.HandlerFunc
}

HandlerConfig is the configuration Object for playground http Handlers

type Handlers

type Handlers []HandlerConfig

Handlers is an array of HandlerConfig The playground expects that you make all assigned Handlers available on the corresponding Path

type Playground

type Playground struct {
	// contains filtered or unexported fields
}

Playground manages the configuration of all HTTP handlers responsible for serving the GraphQL Playground

func New

func New(config Config) *Playground

New creates a Playground for given Config

func (*Playground) Handlers

func (p *Playground) Handlers() (handlers Handlers, err error)

Handlers configures and returns all Handlers for the Playground

Jump to

Keyboard shortcuts

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