Documentation ¶
Index ¶
- Constants
- type Aloja
- type ParamCol
- type Subrouter
- func (s *Subrouter) Delete(path string, handler http.Handler)
- func (s *Subrouter) Get(path string, handler http.Handler)
- func (s *Subrouter) Handle(method string, path string, h http.Handler)
- func (s *Subrouter) HandleFunc(method string, path string, f func(w http.ResponseWriter, r *http.Request))
- func (s *Subrouter) NewSubrouter(subpath string, middlewares ...mw.Middleware) *Subrouter
- func (s *Subrouter) Options(path string, handler http.Handler)
- func (s *Subrouter) Patch(path string, handler http.Handler)
- func (s *Subrouter) Post(path string, handler http.Handler)
- func (s *Subrouter) Put(path string, handler http.Handler)
- func (s *Subrouter) ServeStatic(rpath string, dir string)
- func (s *Subrouter) Use(m ...mw.Middleware)
- func (s *Subrouter) UseHandler(handler http.Handler)
Constants ¶
const (
VERSION = "v0.2.0"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aloja ¶
type Aloja struct { *Subrouter // contains filtered or unexported fields }
Aloja has the methods to abstract the work away. It provides a default Subrouter to carry on requests to '/'. You can coall NewSubrouter method on it to group routes and apply different middlewares to them
func New ¶
New creates a new Aloja with options. Accepted are: - Host - Port - SSLConf It exposes a global middleware that is called on every request, independently of the sobrouter configured if any
func (*Aloja) AddGlobal ¶
func (s *Aloja) AddGlobal(m ...mw.Middleware)
Add stacks a new middleware. It will be the last called. It accepts a list of middlewares and ordere is preserved left to right.
func (*Aloja) LoadTemplates ¶
type Subrouter ¶
func (*Subrouter) HandleFunc ¶
func (s *Subrouter) HandleFunc(method string, path string, f func(w http.ResponseWriter, r *http.Request))
HandleFunc serves an endpoint with the provided handler
func (*Subrouter) NewSubrouter ¶
func (s *Subrouter) NewSubrouter(subpath string, middlewares ...mw.Middleware) *Subrouter
func (*Subrouter) ServeStatic ¶
ServeStatic provides a quick way to serve static files
func (*Subrouter) Use ¶
func (s *Subrouter) Use(m ...mw.Middleware)
func (*Subrouter) UseHandler ¶ added in v0.2.0
UseHandler registers an http.Handler as a middleware.