iris/_examples/tutorial/mvc/main.go
kataras 2786ca1960 MVC Example - you can learn a lot | Asleep for your eyes (again)
Former-commit-id: cd66c00b29c903b724763cb84cae96426934acb5
2017-08-13 07:57:47 +03:00

25 lines
558 B
Go

package main
import (
"github.com/kataras/iris/_examples/tutorial/mvc/controllers"
"github.com/kataras/iris/_examples/tutorial/mvc/persistence"
"github.com/kataras/iris"
)
func main() {
app := iris.New()
app.RegisterView(iris.HTML("./views", ".html"))
db := persistence.OpenDatabase("a fake db")
controllers.RegisterController(app, "/", new(controllers.Index))
controllers.RegisterController(app, "/user/{userid:int}",
controllers.NewUserController(db))
// http://localhost/
// http://localhost:8080/user/42
app.Run(iris.Addr(":8080"))
}