gocloud.devgocloud.dev/server/driver Index | Files

package driver

import "gocloud.dev/server/driver"

Package driver defines an interface for custom HTTP listeners.

Index

Types

type Server

type Server interface {
	// ListenAndServe listens on the TCP network address addr and then
	// calls Serve with handler to handle requests on incoming connections.
	// The addr argument will be a non-empty string specifying "host:port".
	// The http.Handler will always be non-nil.
	// Provider implementations must block until serving is done (or
	// return an error if serving can't occur for some reason), serve
	// requests to the given http.Handler, and be interruptable by Shutdown.
	// Provider implementations should use the given address
	// if they serve using TCP directly.
	ListenAndServe(addr string, h http.Handler) error
	// Shutdown gracefully shuts down the server without interrupting
	// any active connections. If the provided context expires before
	// the shutdown is complete, Shutdown returns the context's error,
	// otherwise it returns any error returned from closing the Server's
	// underlying Listener(s).
	Shutdown(ctx context.Context) error
}

Server dispatches requests to an http.Handler.

Source Files

driver.go

Version
v0.14.0
Published
May 29, 2019
Platform
js/wasm
Imports
2 packages
Last checked
17 hours ago

Tools for package owners.