Documentation ¶
Index ¶
- func Redirect(to string) func(c *Context)
- func Walk(fs http.FileSystem, base string, ...) error
- type Context
- func (c *Context) Error(code int, msg string)
- func (c *Context) ErrorObject(code int, obj interface{})
- func (c *Context) FormValue(k string) string
- func (c *Context) FormValueAsSlice(k string, delim string) []string
- func (c *Context) FormValueUint64(k string) uint64
- func (c *Context) GetObject(obj interface{}) error
- func (c *Context) GetRequest() *http.Request
- func (c *Context) GetUser() string
- func (c *Context) GetVar(k string) (string, bool)
- func (c *Context) GetVarAsSlice(k string, delim string, def []string) []string
- func (c *Context) GetVarDefault(k string, def string) string
- func (c *Context) ParseForm() error
- func (c *Context) QueryHas(key string) bool
- func (c *Context) QueryValue(key string) string
- func (c *Context) QueryValueWithDefault(key string, def string) string
- func (c *Context) Redirect(url string)
- func (c *Context) Render(tmpl string, content interface{})
- func (c *Context) RenderEx(tmpl string, content interface{})
- func (c *Context) RenderWithMeta(tmpl string, meta map[string]string, content interface{})
- func (c *Context) Reply(msg string)
- func (c *Context) ReplyObject(obj interface{})
- func (c *Context) ReplyWithHeaders(msg string, kv map[string]string)
- func (c *Context) Writer() http.ResponseWriter
- type RouteBuilder
- func (r *RouteBuilder) BuildRoute(s *Server) http.HandlerFunc
- func (r *RouteBuilder) WithAuth(auth auth.Authenticator) *RouteBuilder
- func (r *RouteBuilder) WithContent(contentHandler func(c *Context)) *RouteBuilder
- func (r *RouteBuilder) WithLoginHandler(loginHandler func(c *Context) bool) *RouteBuilder
- type Server
- func (s *Server) AddRoute(path string, r *RouteBuilder) *mux.Route
- func (s *Server) Dump()
- func (s *Server) EnableStatus(path string)
- func (s *Server) EnableTestMode(enable bool) *Server
- func (s *Server) HandleFunc(path string, f func(c *Context)) *mux.Route
- func (s *Server) HandleFuncAuthenticated(path, redirect string, f func(c *Context)) *mux.Route
- func (s *Server) HandleFuncAuthenticatedWithLogin(path string, loginHandler func(c *Context) bool, ...) *mux.Route
- func (s *Server) HandleFuncCustomAuth(auth auth.Authenticator, path, redirect string, f func(c *Context)) *mux.Route
- func (s *Server) LoadTemplatesFS(fs http.FileSystem, base string) (*template.Template, error)
- func (s *Server) Router() *mux.Router
- func (s *Server) Serve() error
- func (s *Server) ServeTLS(keyPath string, certPath string) error
- func (s *Server) ServeTLSRedirect(address string) error
- func (s *Server) SetDebug(enable bool)
- func (s *Server) SetTemplatePath(tmplPath string)
- func (s *Server) SetTheme(themePath string)
- func (s *Server) WithAuth(auth auth.Authenticator) *Server
- func (s *Server) WithDebug(debugURL string) *Server
- func (s *Server) WithHealthCheck(version, date string, status func() (bool, string))
- func (s *Server) WithMetadata(meta map[string]string) *Server
- func (s *Server) WithRootFileSystem(fs http.FileSystem) *Server
- func (s *Server) WithStaticFiles(prefix string) *Server
- func (s *Server) WithTemplateFuncs(funcs template.FuncMap) *Server
- func (s *Server) WithTheme(themeURL string) *Server
- type SnapBaseContent
- type SnapContent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) ErrorObject ¶ added in v1.0.0
func (*Context) FormValueAsSlice ¶ added in v1.0.0
func (*Context) FormValueUint64 ¶
func (*Context) GetRequest ¶
func (*Context) GetVarAsSlice ¶ added in v1.0.0
func (*Context) QueryValue ¶
func (*Context) QueryValueWithDefault ¶
func (*Context) RenderWithMeta ¶ added in v1.0.0
func (*Context) ReplyObject ¶
func (c *Context) ReplyObject(obj interface{})
func (*Context) ReplyWithHeaders ¶ added in v1.0.0
func (*Context) Writer ¶
func (c *Context) Writer() http.ResponseWriter
type RouteBuilder ¶ added in v1.0.1
type RouteBuilder struct {
// contains filtered or unexported fields
}
func NewRouteBuilder ¶ added in v1.0.1
func NewRouteBuilder() *RouteBuilder
func (*RouteBuilder) BuildRoute ¶ added in v1.0.1
func (r *RouteBuilder) BuildRoute(s *Server) http.HandlerFunc
func (*RouteBuilder) WithAuth ¶ added in v1.0.1
func (r *RouteBuilder) WithAuth(auth auth.Authenticator) *RouteBuilder
func (*RouteBuilder) WithContent ¶ added in v1.0.1
func (r *RouteBuilder) WithContent(contentHandler func(c *Context)) *RouteBuilder
func (*RouteBuilder) WithLoginHandler ¶ added in v1.0.1
func (r *RouteBuilder) WithLoginHandler(loginHandler func(c *Context) bool) *RouteBuilder
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AddRoute ¶ added in v1.0.1
func (s *Server) AddRoute(path string, r *RouteBuilder) *mux.Route
func (*Server) EnableStatus ¶
func (*Server) EnableTestMode ¶ added in v1.0.0
func (*Server) HandleFuncAuthenticated ¶
func (*Server) HandleFuncAuthenticatedWithLogin ¶ added in v1.0.0
func (*Server) HandleFuncCustomAuth ¶
func (*Server) LoadTemplatesFS ¶ added in v1.0.0
func (*Server) ServeTLSRedirect ¶ added in v1.0.1
func (*Server) SetTemplatePath ¶
func (*Server) WithAuth ¶ added in v1.0.0
func (s *Server) WithAuth(auth auth.Authenticator) *Server
func (*Server) WithHealthCheck ¶ added in v1.0.0
func (*Server) WithMetadata ¶ added in v1.0.0
func (*Server) WithRootFileSystem ¶ added in v1.0.0
func (s *Server) WithRootFileSystem(fs http.FileSystem) *Server
func (*Server) WithStaticFiles ¶
func (*Server) WithTemplateFuncs ¶ added in v1.0.0
type SnapBaseContent ¶
type SnapBaseContent struct { Theme string Content interface{} }
Click to show internal directories.
Click to hide internal directories.