Documentation
¶
Index ¶
- func Serve(views fs.FS, opts ...Option)
- type AccessCheck
- type App
- func (app *App) Protect(h http.Handler, accessCheck AccessCheck) http.HandlerFunc
- func (app *App) ProtectFunc(fn http.HandlerFunc, accessLevel AccessCheck) http.HandlerFunc
- func (app *App) Render(w io.Writer, r *http.Request, page string, data any)
- func (app *App) Serve(name string, accessCheck AccessCheck) *View
- func (app *App) Server() (string, http.Handler)
- func (app *App) Service() Service
- func (app *App) SetTheme(theme string)
- func (app *App) Start() error
- func (app App) Use(name string) Controller
- func (app *App) WithController(name string, controller Controller) error
- func (app *App) WithViews(source fs.FS) error
- type BaseController
- func (c *BaseController) Atoi(name string, defaultValue int) int
- func (c *BaseController) EventStream(w http.ResponseWriter, r *http.Request) (func(string, any), error)
- func (c *BaseController) Redirect(w http.ResponseWriter, r *http.Request, path string)
- func (c *BaseController) Refresh(w http.ResponseWriter, r *http.Request)
- func (c *BaseController) RenderError(w http.ResponseWriter, r *http.Request, err error)
- func (c *BaseController) RenderErrorMsg(w http.ResponseWriter, r *http.Request, msg string)
- func (base *BaseController) Setup(app *App)
- func (base *BaseController) Use(name string) Controller
- type Controller
- type Model
- type Option
- type Service
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessCheck ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) Protect ¶
func (app *App) Protect(h http.Handler, accessCheck AccessCheck) http.HandlerFunc
func (*App) ProtectFunc ¶
func (app *App) ProtectFunc(fn http.HandlerFunc, accessLevel AccessCheck) http.HandlerFunc
func (App) Use ¶
func (app App) Use(name string) Controller
Use returns the controller with the given name
func (*App) WithController ¶
func (app *App) WithController(name string, controller Controller) error
WithController adds a controller to the application
type BaseController ¶
func (*BaseController) EventStream ¶
func (c *BaseController) EventStream(w http.ResponseWriter, r *http.Request) (func(string, any), error)
func (*BaseController) Redirect ¶
func (c *BaseController) Redirect(w http.ResponseWriter, r *http.Request, path string)
func (*BaseController) Refresh ¶
func (c *BaseController) Refresh(w http.ResponseWriter, r *http.Request)
func (*BaseController) RenderError ¶ added in v1.3.0
func (c *BaseController) RenderError(w http.ResponseWriter, r *http.Request, err error)
func (*BaseController) RenderErrorMsg ¶ added in v1.3.0
func (c *BaseController) RenderErrorMsg(w http.ResponseWriter, r *http.Request, msg string)
func (*BaseController) Setup ¶
func (base *BaseController) Setup(app *App)
func (*BaseController) Use ¶
func (base *BaseController) Use(name string) Controller
type Controller ¶
type Controller interface {
Setup(*App)
Handle(*http.Request) Controller
}
type Option ¶
Option is a function that configures an Application
func WithController ¶
func WithController(name string, ctrl Controller) Option
WithController adds a controller to the application
func WithDaisyTheme ¶
WithDaisyTheme sets the theme for the views
func WithHostPrefix ¶
WithHostPrefix sets the host prefix for the views
Click to show internal directories.
Click to hide internal directories.