# 视图配置
//...
.Configure(func(app *yoyogo.WebApplicationBuilder) {
app.UseMvc(func(builder *mvc.ControllerBuilder) {
builder.AddViewsByConfig()
}
}
# hello.tpl
存放在在静态目录 /static/templates/ :
<h1>{[{.name}]}</h1>
# 控制器
func (controller UserController) GetHtmlHello() actionresult.IActionResult {
return controller.View("hello", map[string]interface{}{
"name": "hello world!",
})
}