Documentation ¶
Index ¶
- Constants
- Variables
- func Middleware(echo *echo.Echo) echo.MiddlewareFunc
- func MiddlewareWithConfig(config MiddlewareConfig) echo.MiddlewareFunc
- type Inertia
- func (i *Inertia) GetShared(c echo.Context, key string) (interface{}, bool)
- func (i *Inertia) GetVersion() string
- func (i *Inertia) Render(w io.Writer, name string, data interface{}, c echo.Context) error
- func (i *Inertia) SetVersion(version string)
- func (i *Inertia) SetViteVersion(viteManifestPath ...string) bool
- func (i *Inertia) Share(c echo.Context, key string, value interface{})
- func (i *Inertia) Shared(c echo.Context) map[string]interface{}
- func (i *Inertia) Shares(c echo.Context, values map[string]interface{})
- func (i *Inertia) Version(version func() string)
- type InertiaConfig
- type MiddlewareConfig
- type Response
Constants ¶
View Source
const HeaderLocation = HeaderPrefix + "-Location"
View Source
const HeaderPartialData = HeaderPrefix + "-Partial-Data"
View Source
const HeaderPrefix = "X-Inertia"
The Base "X-Inertia" header prefixes
View Source
const HeaderVersion = HeaderPrefix + "-Version"
Variables ¶
View Source
var DefaultHTTPErrorHandler = func(err error, c echo.Context) { code := http.StatusInternalServerError if he, ok := err.(*echo.HTTPError); ok { code = he.Code } _ = c.Render(code, "Error", map[string]interface{}{ "status": code, }) }
Functions ¶
func Middleware ¶
func Middleware(echo *echo.Echo) echo.MiddlewareFunc
Create a default Inertia Middleware for the given echo reference if the Inertia instance itself is not required in other instances
func MiddlewareWithConfig ¶
func MiddlewareWithConfig(config MiddlewareConfig) echo.MiddlewareFunc
The Inertia Middleware to check every request for what it needs
Types ¶
type Inertia ¶
type Inertia struct {
// contains filtered or unexported fields
}
func NewInertia ¶
func NewInertia(echo *echo.Echo) (i *Inertia)
Instance a new Inertia Handler with a default config
func NewInertiaWithConfig ¶
func NewInertiaWithConfig(config InertiaConfig) (i *Inertia)
Instance a new Inertia Handler with a configuration
func (*Inertia) GetVersion ¶
func (*Inertia) SetViteVersion ¶
Create a version hash off of the manifest.json file md5
type InertiaConfig ¶
type InertiaConfig struct { Echo *echo.Echo PublicPath string TemplatesPath string RootView string TemplateFuncMap template.FuncMap HTTPErrorHandler echo.HTTPErrorHandler RequestIDConfig middleware.RequestIDConfig }
func NewDefaultInertiaConfig ¶
func NewDefaultInertiaConfig(e *echo.Echo) (i InertiaConfig)
Create a default Inertia Config to use without the hassle of setting up everything
type MiddlewareConfig ¶
type MiddlewareConfig struct { Inertia *Inertia Skipper middleware.Skipper }
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func NewResponse ¶
func (Response) ToResponse ¶
func (Response) WithViewData ¶
Click to show internal directories.
Click to hide internal directories.