Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RestPathPrefix = ""
RestPathPrefix is a prefix you can use in front of all goradd rest paths, like a directory path, to indicate that this is a goradd rest path.
Functions ¶
func HandleRequest ¶
func HandleRequest(w http.ResponseWriter, r *http.Request) bool
func Redirect ¶
func Redirect(url string)
Redirect aborts the current page load and tells the browser to load a different url.
func RegisterPath ¶
func RegisterPath(path string, handler RestPathHandler)
RegisterPath associates the given URL path with the given creation function. Call this from an init() function. Afterwards, whenever a user navigates to the given path, the result of the query will be presented to the user.
Types ¶
type HttpError ¶
type HttpError struct {
// contains filtered or unexported fields
}
HttpError represents an error response to a http request.
func (*HttpError) SetResponseHeader ¶
SetResponseHeader sets a key-value in the header response.
type RestManager ¶
type RestManager struct {
// contains filtered or unexported fields
}
The RestManager is a singleton global that manages the registration and deployment of rest paths. It acts like a URL router, returning the RestPathHandler that corresponds to a particular URL path. init() functions should be created for each path that associates a function to create a rest path, with the URL that corresponds to the path.
func GetRestManager ¶
func GetRestManager() *RestManager
GetRestManager returns the current page manager.
type RestManagerI ¶
type RestManagerI interface {
RegisterPath(path string, creationFunction RestPathHandler)
}