视图配置

  1. //...
  2. .Configure(func(app *yoyogo.WebApplicationBuilder) {
  3. app.UseMvc(func(builder *mvc.ControllerBuilder) {
  4. builder.AddViewsByConfig()
  5. }
  6. }

hello.tpl

存放在在静态目录 /static/templates/ :

  1. <h1>{[{.name}]}</h1>

控制器

  1. func (controller UserController) GetHtmlHello() actionresult.IActionResult {
  2. return controller.View("hello", map[string]interface{}{
  3. "name": "hello world!",
  4. })
  5. }