Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher is HTTP server that handles the event of http.Request
func NewDispatcher ¶
func NewDispatcher(p EventParser) *Dispatcher
NewDispatcher returns the event Dispatcher object The argument `p` is that parses event string from *http.Request
func (*Dispatcher) Listen ¶
func (d *Dispatcher) Listen(pattern, addr string) error
Listen starts HTTP server that handling the registered event The first argument `pattern` is the path of the hooks URI (e.g, "/webhooks") The second argument `addr` is a listen address port (e.g, "localhost:3000", ":3000")
func (*Dispatcher) On ¶
func (d *Dispatcher) On(event string, handler http.HandlerFunc)
On adds a handler corresponding the specific event string
func (*Dispatcher) ServeHTTP ¶
func (d *Dispatcher) ServeHTTP(w http.ResponseWriter, r *http.Request)
implements http.Handler
Click to show internal directories.
Click to hide internal directories.