iris/_examples/tutorial/mvc-from-scratch/main.go
kataras 8cd07719a6 Update to 8.2.5 | Say Hello to Controllers. Read HISTORY.md
Former-commit-id: 70f8619440497d132362da86c5187bcc57f8687b
2017-08-13 21:58:34 +03:00

25 lines
589 B
Go

package main
import (
"github.com/kataras/iris/_examples/tutorial/mvc-from-scratch/controllers"
"github.com/kataras/iris/_examples/tutorial/mvc-from-scratch/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:8080/
// http://localhost:8080/user/42
app.Run(iris.Addr(":8080"))
}