1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-19 10:57:05 +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:
Gerasimos (Makis) Maropoulos
2017-12-27 04:15:41 +02:00
parent 8fd4dc2b4b
commit b282e7c563
25 changed files with 110 additions and 119 deletions

View File

@@ -36,7 +36,7 @@ func main() {
ctx.View("shared/error.html")
})
// ---- Register our controllers. ----
// ---- Serve our controllers. ----
// Prepare our repositories and services.
db, err := datasource.LoadUsers(datasource.Memory)
@@ -53,8 +53,8 @@ func main() {
// for the /users based requests.
users.Router.Use(middleware.BasicAuth)
// Bind the "userService" to the UserController's Service (interface) field.
users.AddDependencies(userService)
users.Register(new(controllers.UsersController))
users.Register(userService)
users.Handle(new(controllers.UsersController))
// "/user" based mvc application.
sessManager := sessions.New(sessions.Config{
@@ -62,11 +62,11 @@ func main() {
Expires: 24 * time.Hour,
})
user := mvc.New(app.Party("/user"))
user.AddDependencies(
user.Register(
userService,
sessManager.Start,
)
user.Register(new(controllers.UserController))
user.Handle(new(controllers.UserController))
// http://localhost:8080/noexist
// and all controller's methods like