iris/_examples/mvc/login/_ugly/main.go
Gerasimos (Makis) Maropoulos 32d14db46d Update the _examples/mvc/login example - add a Path property at mvc.Response and add a context.Proceed helper function
Former-commit-id: b898901fe4a324e888a6e09c93530cf7a551cf2a
2017-10-12 16:28:41 +03:00

44 lines
1.0 KiB
Go

package main
import (
"time"
"github.com/kataras/iris/_examples/mvc/login/_ugly/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 aligned 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"),
)
}