server

package
v4.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package server provides a CouchDB server via HTTP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHead

func GetHead(next http.Handler) http.Handler

GetHead automatically route undefined HEAD requests to GET handlers, and discards the response body for such requests.

Forked from chi middleware package.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is a server option.

func WithAuthHandlers

func WithAuthHandlers(h ...auth.Handler) Option

WithAuthHandlers adds the provided auth handlers to the server. May be specified more than once. Order is significant. Each auth request is passed through each handler in the order specified, until one returns a user context or an error. If no handlers are specified, the server will operate as a PERPETUAL ADMIN PARTY!

func WithConfig

func WithConfig(c config.Config) Option

WithConfig sets the server configuration. If not set, [github.com/go-kivik/kivik/v4/x/server/config.Default()] will be used.

func WithUserStores

func WithUserStores(us ...auth.UserStore) Option

WithUserStores adds the provided user stores to the server. May be specified more than once. Order is significant. Each user store is queried in the order specified, until one returns a user context or an error.

type Server

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

Server is a server instance.

func New

func New(client *kivik.Client, options ...Option) *Server

New instantiates a new server instance.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
Package auth provides authentication and authorization for the server.
Package auth provides authentication and authorization for the server.
Package config manages server configuration.
Package config manages server configuration.

Jump to

Keyboard shortcuts

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