1 Star 2 Fork 0

api-go/iris

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"time"
"github.com/kataras/iris/_examples/mvc/login/user"
"github.com/kataras/iris"
"github.com/kataras/iris/sessions"
)
func main() {
app := iris.New()
// You got full debug messages, useful when using MVC and you want to make
// sure that your code is compatible with the Iris' MVC Architecture.
app.Logger().SetLevel("debug")
app.RegisterView(iris.HTML("./views", ".html").Layout("shared/layout.html"))
app.StaticWeb("/public", "./public")
manager := sessions.New(sessions.Config{
Cookie: "sessioncookiename",
Expires: 24 * time.Hour,
})
users := user.NewDataSource()
app.Controller("/user", new(user.Controller), manager, users)
// http://localhost:8080/user/register
// http://localhost:8080/user/login
// http://localhost:8080/user/me
// http://localhost:8080/user/logout
// http://localhost:8080/user/1
app.Run(iris.Addr(":8080"), configure)
}
func configure(app *iris.Application) {
app.Configure(
iris.WithoutServerError(iris.ErrServerClosed),
iris.WithCharset("UTF-8"),
)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/netscript/iris.git
git@gitee.com:netscript/iris.git
netscript
iris
iris
v8.5.2

搜索帮助