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