Documentation
¶
Index ¶
- func Logger(next http.Handler) http.Handler
- func WriteJson(w http.ResponseWriter, status int, v any) error
- type Config
- type Error
- type Handler
- type Middleware
- type Mux
- func (m *Mux) Get(path string, handler Handler)
- func (m *Mux) Handle(method string, path string, handler Handler)
- func (m *Mux) Post(path string, handler Handler)
- func (m *Mux) ServeFile(path string, file string)
- func (m *Mux) ServeFolder(path string, file http.FileSystem)
- func (m *Mux) Use(middle Middleware)
- type Server
- func (s *Server) AddSubRouter(path string, m *Mux)
- func (s *Server) Get(path string, handler Handler)
- func (s *Server) Handle(method string, path string, handler Handler)
- func (s *Server) Post(path string, handler Handler)
- func (s *Server) ServeFile(path string, file string)
- func (s *Server) ServeFolder(path string, file http.FileSystem)
- func (s *Server) Start() error
- func (s *Server) StartWithGracefulShutdown(t int, ctx context.Context, fn func() error) error
- func (s *Server) Use(m Middleware)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config func(*Server)
func WithAddress ¶
func WithCustomLogger ¶
func WithIdleTimeOut ¶
func WithReadTimeout ¶
func WithWriteTimeout ¶
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
func (*Mux) ServeFolder ¶
func (m *Mux) ServeFolder(path string, file http.FileSystem)
func (*Mux) Use ¶
func (m *Mux) Use(middle Middleware)
you can't add middleware after calling AddSubRouter
type Server ¶
type Server struct {
Mux *Mux
// contains filtered or unexported fields
}
func (*Server) AddSubRouter ¶
func (*Server) ServeFolder ¶
func (s *Server) ServeFolder(path string, file http.FileSystem)
func (*Server) StartWithGracefulShutdown ¶
func (*Server) Use ¶
func (s *Server) Use(m Middleware)
you can't add add middleware after starting the server
Click to show internal directories.
Click to hide internal directories.