mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 02:47:04 +00:00
Update to 8.2.5 | Say Hello to Controllers. Read HISTORY.md
Former-commit-id: 70f8619440497d132362da86c5187bcc57f8687b
This commit is contained in:
25
_examples/routing/mvc/main.go
Normal file
25
_examples/routing/mvc/main.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// +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"))
|
||||
}
|
||||
Reference in New Issue
Block a user