Documentation ¶
Overview ¶
Package orujo solves a common problem, which is the execution of several middlewares per route. It has been designed to work seamlessly with the standard net/http library. A simple hello world would look like the following snippet:
package main import ( "fmt" "log" "net/http" "github.com/jroimartin/orujo" ) func main() { http.Handle("/hello", orujo.NewPipe( http.HandlerFunc(helloHandler), orujo.M(http.HandlerFunc(worldHandler)), )) log.Fatal(http.ListenAndServe(":8080", nil)) } func helloHandler(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusInternalServerError) fmt.Fprint(w, "Hello, ") } func worldHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "world") }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Errors ¶
func Errors(w http.ResponseWriter) []error
Errors is used to retrieve the errors registered via RegisterError() during the execution of the handlers pipe.
func RegisterError ¶
func RegisterError(w http.ResponseWriter, err error)
RegisterError can be used by Handlers to register errors.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package basic implements basic auth mechanisms for orujo.
|
Package basic implements basic auth mechanisms for orujo. |
Package log implements the bult-in logging handler of orujo.
|
Package log implements the bult-in logging handler of orujo. |
Package sessions implements the bult-in sessions handler of orujo.
|
Package sessions implements the bult-in sessions handler of orujo. |
Click to show internal directories.
Click to hide internal directories.