aboutsummaryrefslogblamecommitdiff
path: root/template.go
blob: c7db0ae5733f31970faee0338c70fa9f8c7423c5 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13


               









                                     







                                                                                         
package koushin

import (
	"html/template"
	"io"

	"github.com/labstack/echo/v4"
)

type tmpl struct {
	t *template.Template
}

func (t *tmpl) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
	return t.t.ExecuteTemplate(w, name, data)
}

func loadTemplates() (*tmpl, error) {
	t, err := template.New("drmdb").ParseGlob("public/*.html")
	return &tmpl{t}, err
}