1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00

Add a third, simple, example for folder structuring as requested at https://github.com/kataras/iris/issues/748

One change to code base but it will be described at the next version:

Error Handlers (`app.OnErrorCode/OnAnyErrorCode`)  respect the `app.UseGlobal`'s middlewares now (not the `app.Use` for reasons we can all understand, hopefully).


Former-commit-id: ec97bbb04548f9932cf4d7b950be513b70747bcb
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-10-01 16:29:25 +03:00
parent ba63031871
commit 38c6241055
16 changed files with 308 additions and 0 deletions

View File

@@ -534,6 +534,12 @@ func (api *APIBuilder) Controller(relativePath string, controller activator.Base
api.reporter.Add("%v for path: '%s'", err, relativePath)
}
if cInit, ok := controller.(interface {
Init(activator.RegisterFunc)
}); ok {
cInit.Init(registerFunc)
}
return
}
@@ -800,6 +806,10 @@ func (api *APIBuilder) StaticWeb(requestPath string, systemPath string) *Route {
// and/or disable the gzip if gzip response recorder
// was active.
func (api *APIBuilder) OnErrorCode(statusCode int, handlers ...context.Handler) {
if len(api.beginGlobalHandlers) > 0 {
handlers = joinHandlers(api.beginGlobalHandlers, handlers)
}
api.errorCodeHandlers.Register(statusCode, handlers...)
}