From f8d3c0b49488acbb57cfe1c59cfc389dbc2fe60a Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Tue, 23 Jul 2019 17:51:39 +0300 Subject: [PATCH] minor --- MVC.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/MVC.md b/MVC.md index ee95e4d..e4499a8 100644 --- a/MVC.md +++ b/MVC.md @@ -166,6 +166,8 @@ but you can choose what suits you best with Iris, low-level handlers: performance or high-level controllers: easier to maintain and smaller codebase on large applications. +**Read the comments very careful** + ```go package main @@ -226,14 +228,22 @@ func (c *ExampleController) GetHello() interface{} { // and of course before the server ran. // After version 9 you can also add custom routes for a specific controller's methods. // Here you can register custom method's handlers -// use the standard router with `ca.Router` to do something that you can do without mvc as well, -// and add dependencies that will be binded to a controller's fields or method function's input arguments. +// use the standard router with `ca.Router` to +// do something that you can do without mvc as well, +// and add dependencies that will be binded to +// a controller's fields or method function's input arguments. func (c *ExampleController) BeforeActivation(b mvc.BeforeActivation) { anyMiddlewareHere := func(ctx iris.Context) { ctx.Application().Logger().Warnf("Inside /custom_path") ctx.Next() } - b.Handle("GET", "/custom_path", "CustomHandlerWithoutFollowingTheNamingGuide", anyMiddlewareHere) + + b.Handle( + "GET", + "/custom_path", + "CustomHandlerWithoutFollowingTheNamingGuide", + anyMiddlewareHere, + ) // or even add a global middleware based on this controller's router, // which in this example is the root "/":