Route
instance to give a name to the handler registration for easier debugging or match relative paths in views. For more information, checkout the Reverse lookups section./api/user
, without a trailing slash. If a client tries to reach $your_host/api/user/
then the Iris router will automatically permant redirect this to $your_host/api/user
in order to be handled by the registered route. This is the modern way to design APIs.iris.WithoutPathCorrection
option of the iris Configuration to your app.Run
. Example:/api/user
and /api/user/
paths without redirection(common scenario) use just the iris.WithoutPathCorrectionRedirection
option instead:iris.Handler
executed by the registered order when a client requests for that specific resouce path from the server.None
and you can use it to hide a route from outsiders but still able to call it from other route's handlers through the Context.Exec
method. Each API Handle method returns the Route value back. A Route the IsOnline
method which reports back the current state of that route. You can change the state of the route from offline to online and visa-versa through its Route.Method
field's value. Of course each change of the router at serve-time requires an app.RefreshRouter()
call which is safe to use. Take a look below a more complete example:go run main.go
http://localhost:8080/invisible/iris
and you'll see that you get a 404 not found
error,http://localhost:8080/execute
will be able to execute that route.http://localhost:8080/change
and refresh the /invisible/iris
tab you'll see that you can see it..Party
is being used to group routes, developers can declare an unlimited number of (nested) groups.PartyFunc
method which accepts the child router(the Party)."/assets/**/*"
, it's a wildcard with ctx.Params().Get("asset")
equals to any following path after the /assets/
."/profile/"
and followed by a single path part."/profile/me"
and it does not conflict with /profile/{username:string}
or any root wildcard /{root:path}
./users/
and followed by a number which should be equal or higher than 1./users/
and following by a number which should be equal or higher than 1./
, /assets/{asset:path}
, /profile/{username}
, "/profile/me"
, /user/{userid:int ...}
. It does not conflict with the rest of the routes(!)./abctenchars.xml
and /abcdtenchars
respectfully.{id:uint64}
or :path
or min(1)
are. They are (typed) dynamic path parameters and functions can be registered on them. Learn more by reading the Path Parameter Types.