Documentation ¶
Index ¶
- func Logging(next http.Handler, log *logrus.Logger) http.Handler
- func SingleFile(filename string) http.Handler
- type Config
- type IServer
- type LoggingServeMux
- func (mux *LoggingServeMux) Handle(pattern string, handler http.Handler)
- func (mux *LoggingServeMux) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
- func (mux *LoggingServeMux) Handler(r *http.Request) (h http.Handler, pattern string)
- func (mux *LoggingServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type Server
- type ServerEnvironment
- type StatusResponseWriter
- func (w *StatusResponseWriter) Header() http.Header
- func (w *StatusResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
- func (w *StatusResponseWriter) Length() int
- func (w *StatusResponseWriter) Status() int
- func (w *StatusResponseWriter) Write(data []byte) (int, error)
- func (w *StatusResponseWriter) WriteHeader(statusCode int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Port int URL string Admin string Log struct { File string Level string } SSL struct { Key string Certificate string } Jwt struct { Key string } }
Config of a web server
type IServer ¶
type IServer interface { Start() error Stop() }
IServer is an http.ServeMux with a Context.
type LoggingServeMux ¶
type LoggingServeMux struct {
// contains filtered or unexported fields
}
LoggingServeMux logs HTTP requests
func NewLoggingServeMux ¶
func NewLoggingServeMux(conf Config) *LoggingServeMux
NewLoggingServeMux allocates and returns a new LoggingServeMux
func (*LoggingServeMux) Handle ¶
func (mux *LoggingServeMux) Handle(pattern string, handler http.Handler)
Handle register handler
func (*LoggingServeMux) HandleFunc ¶
func (mux *LoggingServeMux) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
HandleFunc registers the handler function for the given pattern.
func (*LoggingServeMux) ServeHTTP ¶
func (mux *LoggingServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP
type Server ¶
type Server struct { http.Server Config Config Error chan error Done chan bool // contains filtered or unexported fields }
Server is a Server with a specialize Context.
type ServerEnvironment ¶
ServerEnvironment configurations
func (*ServerEnvironment) GetEnvironment ¶
func (se *ServerEnvironment) GetEnvironment(environment string) interface{}
GetEnvironment returns a Server configuration for the specified environment in parameter
func (*ServerEnvironment) UnmarshalYAML ¶
func (se *ServerEnvironment) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements Unmarshaler. Avoid use of env in the YAML file.
type StatusResponseWriter ¶
type StatusResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
StatusResponseWriter returns status code
func (*StatusResponseWriter) Header ¶
func (w *StatusResponseWriter) Header() http.Header
Header Satisfy the http.ResponseWriter interface
func (*StatusResponseWriter) Hijack ¶
func (w *StatusResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
Hijack Satisfy the http.ResponseWriter interface
func (*StatusResponseWriter) Length ¶
func (w *StatusResponseWriter) Length() int
Length return response size
func (*StatusResponseWriter) Status ¶
func (w *StatusResponseWriter) Status() int
Status return status code
func (*StatusResponseWriter) Write ¶
func (w *StatusResponseWriter) Write(data []byte) (int, error)
Write Satisfy the http.ResponseWriter interface
func (*StatusResponseWriter) WriteHeader ¶
func (w *StatusResponseWriter) WriteHeader(statusCode int)
WriteHeader writes status code