mirror of
https://github.com/kataras/iris.git
synced 2025-02-03 07:50:34 +01:00
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"))
|
||
|
}
|