httpserver

package
v0.0.0-...-19bf477 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is the server instance.

func NewServer

func NewServer(ctx context.Context, options ...ServerOption) (*Server, error)

NewServer returns a new instance of Server.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the server and is context aware and shuts down when the context gets cancelled.

type ServerOption

type ServerOption = func(srv *Server, m *chi.Mux) error

ServerOption customizes the Server.

func WithGQLHandler

func WithGQLHandler(h http.Handler) ServerOption

WithGQLHandler sets the GQL handler at `/graph` route.

func WithGracefulShutdownTimeout

func WithGracefulShutdownTimeout(d time.Duration) ServerOption

WithGracefulShutdownTimeout overrides the default graceful shutdown timeout with the given value.

func WithIdleTimeout

func WithIdleTimeout(d time.Duration) ServerOption

WithIdleTimeout overrides the default idle timeout with the given value.

func WithPort

func WithPort(port int) ServerOption

WithPort overrides the default server port with the given value.

func WithProfilingHandler

func WithProfilingHandler() ServerOption

WithProfilingHandler enables go's pprof profiling.

func WithRESTHandler

func WithRESTHandler(rtr func(chi.Router)) ServerOption

WithRESTHandler sets the REST route handler.

func WithReadTimeout

func WithReadTimeout(d time.Duration) ServerOption

WithReadTimeout overrides the default read timeout with the given value.

func WithReadinessHandler

func WithReadinessHandler(h http.HandlerFunc) ServerOption

WithReadinessHandler sets the handler for readiness checks at `/_/ready`.

func WithWriteTimeout

func WithWriteTimeout(d time.Duration) ServerOption

WithWriteTimeout overrides the default write timeout with the given value.

Jump to

Keyboard shortcuts

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