1 Star 0 Fork 0

sonysoul/iris

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
identity.go 885 Bytes
一键复制 编辑 原始数据 按行查看 历史
package identity
import (
"time"
"github.com/kataras/iris"
"github.com/kataras/iris/_examples/structuring/bootstrap/bootstrap"
)
// New returns a new handler which adds some headers and view data
// describing the application, i.e the owner, the startup time.
func New(b *bootstrap.Bootstrapper) iris.Handler {
return func(ctx iris.Context) {
// response headers
ctx.Header("App-Name", b.AppName)
ctx.Header("App-Owner", b.AppOwner)
ctx.Header("App-Since", time.Since(b.AppSpawnDate).String())
ctx.Header("Server", "Iris: https://iris-go.com")
// view data if ctx.View or c.Tmpl = "$page.html" will be called next.
ctx.ViewData("AppName", b.AppName)
ctx.ViewData("AppOwner", b.AppOwner)
ctx.Next()
}
}
// Configure creates a new identity middleware and registers that to the app.
func Configure(b *bootstrap.Bootstrapper) {
h := New(b)
b.UseGlobal(h)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sonysoul/iris.git
git@gitee.com:sonysoul/iris.git
sonysoul
iris
iris
v10.0.0

搜索帮助