diff options
Diffstat (limited to 'srv/src/api/render.go')
-rw-r--r-- | srv/src/api/render.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/srv/src/api/render.go b/srv/src/api/render.go index 2b6b5a0..0f45211 100644 --- a/srv/src/api/render.go +++ b/srv/src/api/render.go @@ -178,3 +178,17 @@ func (a *api) renderPostHandler() http.Handler { } }) } + +func (a *api) renderDumbHandler(tplName string) http.Handler { + + tpl := a.mustParseTpl(tplName) + + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + if err := tpl.Execute(rw, nil); err != nil { + apiutil.InternalServerError( + rw, r, fmt.Errorf("rendering %q: %w", tplName, err), + ) + return + } + }) +} |