...

Package server

import "github.com/go-kivik/kivik/v4/x/server"
Overview
Index
Subdirectories

Overview ▾

Package server provides a CouchDB server via HTTP.

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.

type Option

Option is a server option.

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

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

Server is a server instance.

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

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)

Subdirectories

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