Documentation
¶
Index ¶
- func HandleEndpoint(endpoint *LoadedEndpoint, w http.ResponseWriter, r *http.Request, ...) error
- func Load(projectDir string) (map[string]*LoadedEndpoint, error)
- type Context
- func (c *Context) BindForm(v any) error
- func (c *Context) BindJSON(v any) error
- func (c *Context) Cookie(name string) (*http.Cookie, error)
- func (c *Context) HTML(status int, html string) error
- func (c *Context) Header(key string) string
- func (c *Context) JSON(status int, data any) error
- func (c *Context) Param(key string) string
- func (c *Context) Query(key string) string
- func (c *Context) Redirect(url string, status int) error
- func (c *Context) Text(status int, text string) error
- type EndpointCompiler
- type HTTPMethod
- type HandlerFunc
- type LoadedEndpoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleEndpoint ¶
func HandleEndpoint(endpoint *LoadedEndpoint, w http.ResponseWriter, r *http.Request, params map[string]string, locals map[string]any) error
Types ¶
type Context ¶
type Context struct {
Request *http.Request
Response http.ResponseWriter
Params map[string]string
Locals map[string]any
}
func NewContext ¶
type EndpointCompiler ¶
type EndpointCompiler struct {
CacheDir string
BaseDir string
ModuleName string
// contains filtered or unexported fields
}
func NewCompiler ¶
func NewCompiler(baseDir, cacheDir string) *EndpointCompiler
func (*EndpointCompiler) Load ¶
func (c *EndpointCompiler) Load(filePath string) (*LoadedEndpoint, error)
type HTTPMethod ¶
type HTTPMethod string
const ( GET HTTPMethod = "GET" POST HTTPMethod = "POST" PUT HTTPMethod = "PUT" PATCH HTTPMethod = "PATCH" DELETE HTTPMethod = "DELETE" HEAD HTTPMethod = "HEAD" OPTIONS HTTPMethod = "OPTIONS" ALL HTTPMethod = "ALL" )
type HandlerFunc ¶
type LoadedEndpoint ¶
type LoadedEndpoint struct {
Handlers map[HTTPMethod]HandlerFunc
}
func LoadPlugin ¶
func LoadPlugin(pluginPath string) (*LoadedEndpoint, error)
Click to show internal directories.
Click to hide internal directories.