Created
November 19, 2018 06:21
-
-
Save ykyuen/9bfc7a43fb1651f5ad7efe36326dc0f6 to your computer and use it in GitHub Desktop.
setup-nested-html-template-in-go-echo-web-framework-06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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