Core functionality for new aiterp.net servers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
512 B

  1. package wrouter
  2. import (
  3. "net/http"
  4. "git.aiterp.net/gisle/wrouter/auth"
  5. )
  6. // FunctionHandlerFunc is simply a function that is called directly rather than through a struct
  7. type FunctionHandlerFunc func(path string, w http.ResponseWriter, req *http.Request, user *auth.User) bool
  8. type functionHandler struct {
  9. function FunctionHandlerFunc
  10. }
  11. func (handler *functionHandler) Handle(path string, w http.ResponseWriter, req *http.Request, user *auth.User) bool {
  12. return handler.function(path, w, req, user)
  13. }