mirror of
https://github.com/kataras/iris.git
synced 2025-12-22 04:17:03 +00:00
Replace controller's .Register with .Handle and AddDependencies with .Register in order to be aligned with the 'hero' package, all examples and docs are updated, it's crazy how I can't stop even on Christmas
Former-commit-id: 3b42963e9806e327ee42942cf156bda6059eaf8f
This commit is contained in:
@@ -11,7 +11,7 @@ func main() {
|
||||
templates := iris.HTML("./views", ".html").Layout("shared/layout.html")
|
||||
app.RegisterView(templates)
|
||||
|
||||
mvc.New(app).Register(new(Controller))
|
||||
mvc.New(app).Handle(new(Controller))
|
||||
|
||||
// http://localhost:9091
|
||||
app.Run(iris.Addr(":9091"))
|
||||
|
||||
@@ -10,10 +10,10 @@ type postValue func(string) string
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
||||
mvc.New(app.Party("/user")).AddDependencies(
|
||||
mvc.New(app.Party("/user")).Register(
|
||||
func(ctx iris.Context) postValue {
|
||||
return ctx.PostValue
|
||||
}).Register(new(UserController))
|
||||
}).Handle(new(UserController))
|
||||
|
||||
// GET http://localhost:9092/user
|
||||
// GET http://localhost:9092/user/42
|
||||
|
||||
@@ -41,14 +41,14 @@ func main() {
|
||||
todosApp := mvc.New(todosRouter)
|
||||
|
||||
// any dependencies bindings here...
|
||||
todosApp.AddDependencies(
|
||||
todosApp.Register(
|
||||
todo.NewMemoryService(),
|
||||
sess.Start,
|
||||
ws.Upgrade,
|
||||
)
|
||||
|
||||
// controllers registration here...
|
||||
todosApp.Register(new(controllers.TodoController))
|
||||
todosApp.Handle(new(controllers.TodoController))
|
||||
|
||||
// start the web server at http://localhost:8080
|
||||
app.Run(iris.Addr(":8080"), iris.WithoutVersionChecker)
|
||||
|
||||
Reference in New Issue
Block a user