server

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHuma

func NewHuma(params HumaParams) huma.API

func NewMux

func NewMux(params MuxParams) *chi.Mux

Types

type Addr added in v0.3.0

type Addr string

func ListenAddress added in v0.4.10

func ListenAddress(addr string) Addr

func ListenAddressFromEnv added in v0.4.10

func ListenAddressFromEnv(env string, defaultValue ...string) Addr

type CorsConfig added in v0.6.3

type CorsConfig struct {
	AllowedOrigins   []string
	AllowedMethods   []string
	AllowedHeaders   []string
	ExposedHeaders   []string
	AllowCredentials bool
	MaxAge           int
}

func WithCors added in v0.6.3

func WithCors(config CorsConfig) *CorsConfig

type HumaParams added in v0.3.0

type HumaParams struct {
	fx.In
	Manifest      *manifest.Manifest
	Mux           *chi.Mux
	AuthProviders *auth.Providers `optional:"true"`
}

type MuxParams added in v0.4.0

type MuxParams struct {
	fx.In
	UseCors UseCors     `optional:"true"`
	Cors    *CorsConfig `optional:"true"`
}

type Params added in v0.3.0

type Params struct {
	fx.In
	Addr      Addr `optional:"true"`
	Router    *Router
	ApiConfig *api.Config    `optional:"true"`
	Handlers  []*api.Handler `group:"api.handler"`
}

type Router

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

func NewRouter

func NewRouter(cfg RouterConfig) *Router

type RouterConfig

type RouterConfig struct {
	fx.In
	Mux            *chi.Mux
	Api            huma.API
	AuthMiddleware *auth.Middleware
}

type Server

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

func New

func New(params Params) *Server

func (*Server) OnStart

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

func (*Server) OnStop

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

type UseCors added in v0.4.0

type UseCors bool

UseCors define if the server should use CORS Deprecated: use CorsConfig instead

Jump to

Keyboard shortcuts

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