mirror of
https://github.com/kataras/iris.git
synced 2025-03-15 14:56:28 +01:00
26 lines
535 B
Go
26 lines
535 B
Go
|
// +build !go1.9
|
||
|
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"github.com/kataras/iris/_examples/routing/mvc/controllers"
|
||
|
"github.com/kataras/iris/_examples/routing/mvc/persistence"
|
||
|
|
||
|
"github.com/kataras/iris"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
app := iris.New()
|
||
|
app.RegisterView(iris.HTML("./views", ".html"))
|
||
|
|
||
|
db := persistence.OpenDatabase("a fake db")
|
||
|
|
||
|
app.Controller("/", new(controllers.Index))
|
||
|
|
||
|
app.Controller("/user/{userid:int}", controllers.NewUserController(db))
|
||
|
|
||
|
// http://localhost:8080/
|
||
|
// http://localhost:8080/user/42
|
||
|
app.Run(iris.Addr(":8080"))
|
||
|
}
|