package module
Version: v0.0.0-...-5baaa16 Latest Latest

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

Go to latest
Published: Jul 3, 2020 License: MPL-2.0 Imports: 8 Imported by: 0




This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.



Package goblet implements TODO



This section is empty.


This section is empty.


func Segments

func Segments(request *http.Request, segments []string)

Segments TODO


type Decorator

type Decorator func(http.Handler) http.Handler

Decorator TODO

func Use

func Use(decorators ...Decorator) Decorator


func (Decorator) After

func (decorator Decorator) After(
	decorators ...Decorator,
) Decorator

After TODO

func (Decorator) Before

func (decorator Decorator) Before(
	decorators ...Decorator,
) Decorator

Before TODO

func (Decorator) Decorate

func (decorator Decorator) Decorate(
	handler http.Handler,
) http.Handler

Decorate TODO

func (Decorator) DecorateFunc

func (decorator Decorator) DecorateFunc(
	handler http.HandlerFunc,
) http.Handler

DecorateFunc TODO

type Router

type Router struct {
	// contains filtered or unexported fields

Router TODO

func (*Router) Handle

func (router *Router) Handle(
	path string,
	handler http.Handler,
	methods ...string,

Handle TODO

func (*Router) HandleFunc

func (router *Router) HandleFunc(
	path string,
	handler http.HandlerFunc,
	methods ...string,

HandleFunc TODO

func (*Router) Prefix

func (router *Router) Prefix(path string) *Router

Prefix TODO

func (*Router) ServeHTTP

func (router *Router) ServeHTTP(
	writer http.ResponseWriter,
	request *http.Request,


type Service

type Service struct {
	// CertFile is the path to the Server certificate file.
	// KeyFile is the path to the Server key file.
	// TLS will be enabled when both values are set.
	KeyFile string

	// Timeout is the optional amount of time to wait for Server.Shutdown() to
	// complete.
	Timeout time.Duration
	// contains filtered or unexported fields

Service is responsible to start and gracefully stop an embedded http.Server. The Router methods have been promoted to easily register instances of http.Handler with an instance of Service.

Zero values are valid configurations.

func New

func New(address string) *Service


func (*Service) Start

func (service *Service) Start(
	ctx context.Context,
) error

Start executes asynchronously Server.ListenAndServe() or Server.ListenAndServeTLS(), based on the current configuration, then it waits for one of the following stop signals:

- Context cancellation (optional)
- os.Signal notification (syscall.SIGINT or syscall.SIGTERM)

In case an error occurs during the startup, the function returns that error immediately.

Once the stop signal is received, the function waits for the execution of Server.Shutdown() and it returns any occurred error, nil otherwise. During this phase, if Timeout is greater than zero, a new Context with the specified timeout will be used, otherwise the default background Context will be used.

Start should be usually called by the main function, and it cannot be invoked more than once.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL