Skip to content

Instantly share code, notes, and snippets.

@tkc tkc/EchoTemplate
Created Aug 18, 2016

What would you like to do?
package main
import (
type Template struct {
templates *template.Template
func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
return t.templates.ExecuteTemplate(w, name, data)
func Hello(c echo.Context) error {
return c.Render(http.StatusOK, "hello", "world")
func main() {
fmt.Println("sever start")
t := &Template{
templates: template.Must(template.ParseGlob("public/views/*.html")),
e := echo.New()
e.GET("/hello", Hello)
{{define "hello"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.