package main import ( "github.com/go-martini/martini" "github.com/martini-contrib/render" "net/http" ) func main() { m := martini.Classic() m.Use(render.Renderer()) m.Get("/status", func(r render.Render) { data := map[string]interface{}{ "title": "Status", "status": "OK", } r.HTML(http.StatusOK, "status", data) }) m.Run() }
When the `GET /status` endpoint is accessed, the `Render` middleware will render this template with the given data and respond with the HTML.{{.title}} Status: {{.status}}