Skip to content

Instantly share code, notes, and snippets.

@ykyuen
Created November 19, 2018 06:21
Show Gist options
  • Save ykyuen/9bfc7a43fb1651f5ad7efe36326dc0f6 to your computer and use it in GitHub Desktop.
Save ykyuen/9bfc7a43fb1651f5ad7efe36326dc0f6 to your computer and use it in GitHub Desktop.
setup-nested-html-template-in-go-echo-web-framework-06
package handler
import (
"net/http"
"github.com/labstack/echo"
)
func HomeHandler(c echo.Context) error {
// Please note the the second parameter "home.html" is the template name and should
// be equal to the value stated in the {{ define }} statement in "view/home.html"
return c.Render(http.StatusOK, "home.html", map[string]interface{}{
"name": "HOME",
"msg": "Hello, Boatswain!",
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment