AddServer same as .Servers.Add(ServerConfiguration)
AddServer starts a server which listens to this station Note that the view engine's functions {{ url }} and {{ urlpath }} will return the first's registered server's scheme (http/https)
this is useful mostly when you want to have two or more listening ports ( two or more servers ) for the same station
receives one parameter which is the ServerConfiguration for the new server returns the new standalone server( you can close this server by the returning reference)
If you need only one server you can use the blocking-funcs: .Listen/ListenTLS/ListenUNIX/ListenTo
this is a NOT A BLOCKING version, the main .Listen/ListenTLS/ListenUNIX/ListenTo should be always executed LAST, so this function goes before the main .Listen/ListenTLS/ListenUNIX/ListenTo.
Any registers a route for ALL of the http methods (Get,Post,Put,Head,Patch,Options,Connect,Delete).
API converts & registers a custom struct to the router receives two parameters first is the request path (string) second is the custom struct (interface{}) which can be anything that has a *iris.Context as field.
CheckForUpdates will try to search for newer version of Iris based on the https://github.com/kataras/iris/releases If a newer version found then the app will ask the he dev/user if want to update the 'x' version if 'y' is pressed then the updater will try to install the latest version the updater, will notify the dev/user that the update is finished and should restart the App manually.
Close terminates all the registered servers and returns an error if any if you want to panic on this error use the iris.Must(iris.Close()).
Connect registers a route for the Connect http method.
DecodeFasthttpURL returns the path decoded as url useful when you want to pass something to a database and be valid to retrieve it via context.Param use it only for special cases, when the default behavior doesn't suits you.
DecodeURL returns the uri parameter as url (string) useful when you want to pass something to a database and be valid to retrieve it via context.Param use it only for special cases, when the default behavior doesn't suits you.
DefaultConfiguration returns the default configuration for an Iris station, fills the main Configuration.
DefaultServerConfiguration returns the default configs for the server.
DefaultSessionsConfiguration the default configs for Sessions.
DefaultTesterConfiguration returns the default configuration for a tester the ListeningAddr is used as virtual only when no running server is founded.
DefaultWebsocketConfiguration returns the default config for iris-ws websocket package.
Delete registers a route for the Delete http method.
Done registers Handler 'middleware' the only difference from .Use is that it should be used BEFORE any party route registered or AFTER ALL party's routes have been registered.
DoneFunc registers HandlerFunc 'middleware' the only difference from .Use is that it should be used BEFORE any party route registered or AFTER ALL party's routes have been registered.
EmitError fires a custom http error handler to the client
if no custom error defined with this statuscode, then iris creates one, and once at runtime.
Favicon serves static favicon accepts 2 parameters, second is optional favPath (string), declare the system directory path of the __.ico requestPath (string), it's the route's path, by default this is the "/favicon.ico" because some browsers tries to get this by default first, you can declare your own path if you have more than one favicon (desktop, mobile and so on)
this func will add a route for you which will static serve the /yuorpath/yourfile.ico to the /yourfile.ico (nothing special that you can't handle by yourself) Note that you have to call it on every favicon you have to serve automatically (dekstop, mobile and so on)
panics on error.
Get registers a route for the Get http method.
Go starts the iris station, listens to all registered servers, and prepare only if Virtual.
Handle registers a route to the server's router if empty method is passed then registers handler(s) for all methods, same as .Any, but returns nil as result.
HandleFunc registers and returns a route with a method string, path string and a handler registedPath is the relative url path.
Head registers a route for the Head http method.
Listen starts the standalone http server which listens to the addr parameter which as the form of host:port
It panics on error if you need a func to return an error, use the ListenTo.
ListenTLS Starts a https server with certificates, if you use this method the requests of the form of 'http://' will fail only https:// connections are allowed which listens to the addr parameter which as the form of host:port
It panics on error if you need a func to return an error, use the ListenTo ex: iris.ListenTLS(":8080","yourfile.cert","yourfile.key").
ListenTLSAuto starts a server listening at the specific nat address using key & certification taken from the letsencrypt.org 's servers it also starts a second 'http' server to redirect all 'http://$ADDR_HOSTNAME:80' to the' https://$ADDR'
Notes: if you don't want the last feature you should use this method: iris.ListenTo(iris.ServerConfiguration{ListeningAddr: "mydomain.com:443", AutoTLS: true}) it's a blocking function Limit : https://github.com/iris-contrib/letsencrypt/blob/master/lets.go#L142
example: https://github.com/iris-contrib/examples/blob/master/letsencyrpt/main.go.
ListenTo listens to a server but accepts the full server's configuration returns an error, you're responsible to handle that ex: ris.ListenTo(iris.ServerConfiguration{ListeningAddr:":8080"}) ex2: err := iris.ListenTo(iris.OptionServerListeningAddr(":8080")) or use the iris.Must(iris.ListenTo(iris.ServerConfiguration{ListeningAddr:":8080"}))
it's a blocking func.
ListenUNIX starts the process of listening to the new requests using a 'socket file', this works only on unix
It panics on error if you need a func to return an error, use the ListenTo ex: iris.ListenUNIX(":8080", Mode: os.FileMode).
ListenVirtual is useful only when you want to test Iris, it doesn't starts the server but it configures and returns it initializes the whole framework but server doesn't listens to a specific net.Listener it is not blocking the app.
Lookup returns a registed route by its name.
Lookups returns all registed routes.
Must panics on error, it panics on registed iris' logger.
New creates and returns a new Iris instance.
NewLoggerHandler is a basic Logger middleware/Handler (not an Entry Parser).
NewSSHServer returns a new empty SSHServer.
NewTester Prepares and returns a new test framework based on the api is useful when you need to have more than one test framework for the same iris insttance, otherwise you can use the iris.Tester(t *testing.T)/variable.Tester(t *testing.T).
NewWebsocketServer returns an empty WebsocketServer, nothing special here.
OnError registers a custom http error handler.
Options registers a route for the Options http method.
ParseParams receives a string and returns PathParameters (slice of PathParameter) received string must have this form: key1=value1,key2=value2...
Party is just a group joiner of routes which have the same prefix and share same middleware(s) also.
Patch registers a route for the Patch http method.
Path used to check arguments with the route's named parameters and return the correct url if parse failed returns empty string.
Post registers a route for the Post http method.
Put registers a route for the Put http method.
RouteConflicts checks for route's middleware conflicts.
SerializeToString returns the string of a serializer, does not render it to the client returns empty string on error.
ServerParseAddr parses the listening addr and returns this.
Set sets an option aka configuration field to the default iris instance.
Static registers a route which serves a system directory this doesn't generates an index page which list all files no compression is used also, for these features look at StaticFS func accepts three parameters first parameter is the request url path (string) second parameter is the system directory (string) third parameter is the level (int) of stripSlashes * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: "".
StaticContent serves bytes, memory cached, on the reqPath a good example of this is how the websocket server uses that to auto-register the /iris-ws.js.
StaticFS registers a route which serves a system directory this is the fastest method to serve static files generates an index page which list all files if you use this method it will generate compressed files also think this function as small fileserver with http accepts three parameters first parameter is the request url path (string) second parameter is the system directory (string) third parameter is the level (int) of stripSlashes * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: "".
StaticHandler returns a Handler to serve static system directory Accepts 5 parameters
first is the systemPath (string) Path to the root directory to serve files from.
StaticServe serves a directory as web resource it's the simpliest form of the Static* functions Almost same usage as StaticWeb accepts only one required parameter which is the systemPath ( the same path will be used to register the GET&HEAD routes) if second parameter is empty, otherwise the requestPath is the second parameter it uses gzip compression (compression on each request, no file cache).
StaticWeb same as Static but if index.html exists and request uri is '/' then display the index.html's contents accepts three parameters first parameter is the request url path (string) second parameter is the system directory (string) third parameter is the level (int) of stripSlashes * stripSlashes = 0, original path: "/foo/bar", result: "/foo/bar" * stripSlashes = 1, original path: "/foo/bar", result: "/bar" * stripSlashes = 2, original path: "/foo/bar", result: "" * if you don't know what to put on stripSlashes just 1.
StatusText returns a text for the HTTP status code.
TemplateSourceString executes a template source(raw string contents) from the first template engines which supports raw parsing returns its result as string, useful when you want it for sending rich e-mails returns empty string on error.
TemplateString executes a template from the default template engine and returns its result as string, useful when you want it for sending rich e-mails returns empty string on error.
Tester returns the test framework for this default insance.
ToHandler converts an httapi.Handler or http.HandlerFunc to an iris.Handler.
ToHandlerFastHTTP converts an fasthttp.RequestHandler to an iris.Handler.
ToHandlerFunc converts an http.Handler or http.HandlerFunc to an iris.HandlerFunc.
Trace registers a route for the Trace http method.
URL returns the subdomain+ host + Path(...optional named parameters if route is dynamic) returns an empty string if parse is failed.
Use registers Handler middleware.
UseFunc registers HandlerFunc middleware.
UseGlobal registers Handler middleware to the beginning, prepends them instead of append
Use it when you want to add a global middleware to all parties, to all routes in all subdomains It can be called after other, (but before .Listen of course).
UseGlobalFunc registers HandlerFunc middleware to the beginning, prepends them instead of append
Use it when you want to add a global middleware to all parties, to all routes in all subdomains It can be called after other, (but before .Listen of course).
UseSerializer accepts a Serializer and the key or content type on which the developer wants to register this serializer the gzip and charset are automatically supported by Iris, by passing the iris.RenderOptions{} map on the context.Render context.Render renders this response or a template engine if no response engine with the 'key' found with these engines you can inject the context.JSON,Text,Data,JSONP,XML also to do that just register with UseSerializer(mySerializer,"application/json") and so on look at the https://github.com/kataras/go-serializer for examples
if more than one serializer with the same key/content type exists then the results will be appended to the final request's body this allows the developer to be able to create 'middleware' responses engines
Note: if you pass an engine which contains a dot('.') as key, then the engine will not be registered.
UseSessionDB registers a session database, you can register more than one accepts a session database which implements a Load(sid string) map[string]interface{} and an Update(sid string, newValues map[string]interface{}) the only reason that a session database will be useful for you is when you want to keep the session's values/data after the app restart a session database doesn't have write access to the session, it doesn't accept the context, so forget 'cookie database' for sessions, I will never allow that, for your protection.
UseTemplate adds a template engine to the iris view system it does not build/load them yet.