github.com/kataras/iris/v12/apps
provides a globally scoped control over all registered Iris Applications of the same Program.Get
functionGet
function returns an Iris Application based on its "appName". It returns nil when no application was found with the given exact name.GetAll() []*iris.Application
function instead._
import statement will call the userapi.init
function (before main
) which initializes an Iris Application, if not already exists, and registers it to the internal global store for further use across packages.Application.SetName
method sets a unique name to this Iris Application. It sets a child prefix for the current Application's Logger. Its Application.String
method returns the given name. It returns itself.main
function creates and registers an Iris Application on "app.company.com"
name, after that declaration every package of the same Program can retrieve that specific Application instance through its name.Switch
functionSwitch
function returns a new Application with the sole purpose of routing the matched Applications through the "provided cases". Read below about the available SwitchProviders and how you can create and use your own one.WrapRouter
method, which is really useful for logging and statistics.SwitchProvider
interfaceSwitch
function.SwitchProvider
should return one or more SwitchCase
values.SwitchCase
structure contains the Filter and the target Iris Application.SwitchOptions
structureSwitch
function.SetHost
function is a SwitchOption. It force sets a Host field for the matched Application's request object. Extremely useful when used with Hosts SwitchProvider. Usecase: www. to root domain without redirection (SEO reasons) and keep the same internal request Host for both of them so the root app's handlers will always work with a single host no matter what the real request Host was.Join
slice to pass more than one provider at the same time.