MCPcopy Create free account
hub / github.com/kataras/iris / RegisterView

Method RegisterView

core/router/api_builder.go:1758–1772  ·  view source on GitHub ↗

RegisterView registers and loads a view engine middleware for this group of routes. It overrides any of the application's root registered view engines. To register a view engine per handler chain see the `Context.ViewEngine` instead. Read `Configuration.ViewEngineContextKey` documentation for more.

(viewEngine context.ViewEngine)

Source from the content-addressed store, hash-verified

1756// To register a view engine per handler chain see the `Context.ViewEngine` instead.
1757// Read `Configuration.ViewEngineContextKey` documentation for more.
1758func (api *APIBuilder) RegisterView(viewEngine context.ViewEngine) {
1759 if err := viewEngine.Load(); err != nil {
1760 api.logger.Error(err)
1761 return
1762 }
1763
1764 handler := func(ctx *context.Context) {
1765 ctx.ViewEngine(viewEngine)
1766 ctx.Next()
1767 }
1768 api.Use(handler)
1769 api.UseError(handler)
1770 // Note (@kataras): It does not return the Party in order
1771 // to keep the iris.Application a compatible Party.
1772}
1773
1774// FallbackView registers one or more fallback views for a template or a template layout.
1775// Usage:

Callers

nothing calls this directly

Calls 6

UseMethod · 0.95
UseErrorMethod · 0.95
ViewEngineMethod · 0.80
NextMethod · 0.80
LoadMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected