1 Star 1 Fork 0

teamlint/iris

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 1015 Bytes
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"os"
"github.com/kataras/iris"
)
type mailData struct {
Title string
Body string
RefTitle string
RefLink string
}
func main() {
app := iris.New()
app.Logger().SetLevel("debug")
app.RegisterView(iris.HTML("./views", ".html"))
// you need to call `app.Build` manually before using the `app.View` func,
// so templates are built in that state.
app.Build()
// Or a string-buffered writer to use its body to send an e-mail
// for sending e-mails you can use the https://github.com/kataras/go-mailer
// or any other third-party package you like.
//
// The template's parsed result will be written to that writer.
writer := os.Stdout
err := app.View(writer, "email/simple.html", "shared/email.html", mailData{
Title: "This is my e-mail title",
Body: "This is my e-mail body",
RefTitle: "Iris web framework",
RefLink: "https://iris-go.com",
})
if err != nil {
app.Logger().Errorf("error from app.View: %v", err)
}
app.Run(iris.Addr(":8080"))
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/teamlint/iris.git
git@gitee.com:teamlint/iris.git
teamlint
iris
iris
v10.6.4

搜索帮助