Documentation ¶
Index ¶
- type FileHandler
- type HandleFunc
- type Route
- type Router
- func (r *Router) Delete(path string, funcs ...HandleFunc)
- func (r *Router) Get(path string, funcs ...HandleFunc)
- func (r *Router) Patch(path string, funcs ...HandleFunc)
- func (r *Router) Post(path string, funcs ...HandleFunc)
- func (r *Router) Put(path string, funcs ...HandleFunc)
- func (r *Router) Root() *Route
- func (r *Router) Static(path string, relativePath string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileHandler ¶
type FileHandler struct { MimeType string // contains filtered or unexported fields }
FileHandler handles the reading of the file
func (*FileHandler) FullPath ¶
func (fh *FileHandler) FullPath() string
FullPath returns the full path of the file.
func (*FileHandler) ReadFile ¶
func (fh *FileHandler) ReadFile() ([]byte, error)
ReadFile reads the file of the provided path. Returns an error if it does not exist.
type HandleFunc ¶
HandleFunc is function that represents the handler for a HTTP-Endpoint
type Route ¶
type Route struct { Get []HandleFunc Post []HandleFunc Put []HandleFunc Delete []HandleFunc Patch []HandleFunc // contains filtered or unexported fields }
Route represents a node in a http-router, and contains http-method-implementation
func (*Route) AppendRouter ¶
AppendRouter adds all the routes inside a given router to the route.
func (*Route) GetHandlers ¶
func (r *Route) GetHandlers(method string) []HandleFunc
GetHandlers gets the handlers for a given method
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router manages routes for given http-endpoints
func (*Router) Delete ¶
func (r *Router) Delete(path string, funcs ...HandleFunc)
Delete initializes a DELETE-endpoint at given path.
func (*Router) Get ¶
func (r *Router) Get(path string, funcs ...HandleFunc)
Get initializes a GET-endpoint at given path.
func (*Router) Patch ¶
func (r *Router) Patch(path string, funcs ...HandleFunc)
Patch initializes a PATCH-endpoint at given path.
func (*Router) Post ¶
func (r *Router) Post(path string, funcs ...HandleFunc)
Post initializes a POST-endpoint at given path.
func (*Router) Put ¶
func (r *Router) Put(path string, funcs ...HandleFunc)
Put initializes a PUT-endpoint at given path.