mirror of
https://github.com/kataras/iris.git
synced 2025-01-24 03:01:03 +01:00
8cd07719a6
Former-commit-id: 70f8619440497d132362da86c5187bcc57f8687b
25 lines
589 B
Go
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"))
|
|
}
|