beego快速体验
func (c *MainController) Get() {
c.Data["Website"] = "beego.me"
c.Data["Email"] = "astaxie@gmail.com"
//c.TplName = "index.tpl"
c.TplName = "test.html"
}
- 在views/文件夹下新建test.html,在body中添加内容
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>hello world</h1>
<h1>{{.Email}}</h1>
</body>
</html>
- 可以看到成功修改bee run默认打开的页面