mirror of
https://github.com/kataras/iris.git
synced 2026-01-08 20:41:57 +00:00
new simple _examples/README.md, wiki should live only inside kataras/iris/wiki and the provided e-book
Former-commit-id: 350eafb0f70f8433e394e103ff93fa332ee00a05
This commit is contained in:
@@ -26,6 +26,14 @@ func (api *APIContainer) Party(relativePath string, handlersFn ...interface{}) *
|
||||
return p.ConfigureContainer()
|
||||
}
|
||||
|
||||
// PartyFunc same as `Party` but it accepts a party builder function instead.
|
||||
// Returns the new Party's APIContainer
|
||||
func (api *APIContainer) PartyFunc(relativePath string, fn func(*APIContainer)) *APIContainer {
|
||||
childContainer := api.Party(relativePath)
|
||||
fn(childContainer)
|
||||
return childContainer
|
||||
}
|
||||
|
||||
// OnError adds an error handler for this Party's DI Hero Container and its handlers (or controllers).
|
||||
// The "errorHandler" handles any error may occurred and returned
|
||||
// during dependencies injection of the Party's hero handlers or from the handlers themselves.
|
||||
@@ -89,6 +97,14 @@ func (api *APIContainer) convertHandlerFuncs(relativePath string, handlersFn ...
|
||||
return handlers
|
||||
}
|
||||
|
||||
// Handler receives a function which can receive dependencies and output result
|
||||
// and returns a common Iris Handler, useful for Versioning API integration otherwise
|
||||
// the `Handle/Get/Post...` methods are preferable.
|
||||
func (api *APIContainer) Handler(handlerFn interface{}, handlerParamsCount int) context.Handler {
|
||||
paramsCount := macro.CountParams(api.Self.GetRelPath(), *api.Self.Macros()) + handlerParamsCount
|
||||
return api.Container.HandlerWithParams(handlerFn, paramsCount)
|
||||
}
|
||||
|
||||
// Use same as `Self.Use` but it accepts dynamic functions as its "handlersFn" input.
|
||||
//
|
||||
// See `OnError`, `RegisterDependency`, `Done` and `Handle` for more.
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -342,7 +343,7 @@ func (r *Route) ResolvePath(args ...string) string {
|
||||
}
|
||||
|
||||
func traceHandlerFile(method, name, line string, number int) string {
|
||||
file := fmt.Sprintf("(%s:%d)", line, number)
|
||||
file := fmt.Sprintf("(%s:%d)", filepath.ToSlash(line), number)
|
||||
|
||||
if context.IgnoreHandlerName(name) {
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user