mirror of
https://github.com/kataras/iris.git
synced 2025-01-26 03:56:34 +01:00
2786ca1960
Former-commit-id: cd66c00b29c903b724763cb84cae96426934acb5
25 lines
558 B
Go
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"))
|
|
}
|