Categorygithub.com/vanekt/iris
modulepackage
10.0.2+incompatible
Repository: https://github.com/vanekt/iris.git
Documentation: pkg.go.dev

# README

Iris Web Framework

build status report card chat view examples release

Iris is a fast, simple yet fully featured and very efficient web framework for Go.

Iris provides a beautifully expressive and easy to use foundation for your next website or API.

Finally, a real expressjs equivalent for the Go Programming Language.

Learn what others say about Iris and star this github repository to stay up to date.

Backers

Thank you to all our backers! πŸ™ Become a backer

$ cat example.go
package main

import "github.com/kataras/iris"

func main() {
    app := iris.New()
    // Load all templates from the "./views" folder
    // where extension is ".html" and parse them
    // using the standard `html/template` package.
    app.RegisterView(iris.HTML("./views", ".html"))

    // Method:    GET
    // Resource:  http://localhost:8080
    app.Get("/", func(ctx iris.Context) {
        // Bind: {{.message}} with "Hello world!"
        ctx.ViewData("message", "Hello world!")
        // Render template file: ./views/hello.html
        ctx.View("hello.html")
    })

    // Method:    GET
    // Resource:  http://localhost:8080/user/42
    //
    // Need to use a custom regexp instead?
    // Easy,
    // just mark the parameter's type to 'string'
    // which accepts anything and make use of
    // its `regexp` macro function, i.e:
    // app.Get("/user/{id:string regexp(^[0-9]+$)}")
    app.Get("/user/{id:long}", func(ctx iris.Context) {
        userID, _ := ctx.Params().GetInt64("id")
        ctx.Writef("User ID: %d", userID)
    })

    // Start the server using a network address.
    app.Run(iris.Addr(":8080"))
}

Learn more about path parameter's types by clicking here

<!-- file: ./views/hello.html -->
<html>
<head>
    <title>Hello Page</title>
</head>
<body>
    <h1>{{.message}}</h1>
</body>
</html>
$ go run example.go
Now listening on: http://localhost:8080
Application Started. Press CTRL+C to shut down.
_

Installation

The only requirement is the Go Programming Language

$ go get -u github.com/kataras/iris

Iris takes advantage of the vendor directory feature. You get truly reproducible builds, as this method guards against upstream renames and deletes.

Iris vs .NET Core(C#) vs Node.js (Express)

Updated at: Tuesday, 21 November 2017

Benchmarks from third-party source over the rest web frameworks

Comparison with other frameworks

Support

  • HISTORY file is your best friend, it contains information about the latest features and changes
  • Did you happen to find a bug? Post it at github issues
  • Do you have any questions or need to speak with someone experienced to solve a problem at real-time? Join us to the community chat
  • Complete our form-based user experience report by clicking here
  • Do you like the framework? Tweet something about it! The People have spoken:



For more information about contributing to the Iris project please check the CONTRIBUTING.md file.

List of all Contributors

Learn

First of all, the most correct way to begin with a web framework is to learn the basics of the programming language and the standard http capabilities, if your web application is a very simple personal project without performance and maintainability requirements you may want to proceed just with the standard packages. After that follow the guidelines:

  • Navigate through 100+1 examples and some iris starter kits we crafted for you
  • Read the godocs for any details
  • Prepare a cup of coffee or tea, whatever pleases you the most, and read some articles we found for you

Iris starter kits

  1. A basic web app built in Iris for Go
  2. A mini social-network created with the awesome IrisπŸ’–πŸ’–
  3. Iris isomorphic react/hot reloadable/redux/css-modules starter kit
  4. Demo project with react using typescript and Iris
  5. Self-hosted Localization Management Platform built with Iris and Angular
  6. Iris + Docker and Kubernetes
  7. Quickstart for Iris with Nanobox
  8. A Hasura starter project with a ready to deploy Golang hello-world web app with IRIS

Did you build something similar? Let us know!

Middleware

Iris has a great collection of handlers[1][2] that you can use side by side with your web apps. However you are not limited to them - you are free to use any third-party middleware that is compatible with the net/http package, _examples/convert-handlers will show you the way.

Iris, unlike others, is 100% compatible with the standards and that's why the majority of the big companies that adapt Go to their workflow, like a very famous US Television Network, trust Iris; it's always up-to-date and it will be aligned with the std net/http package which is modernized by the Go Author on each new release of the Go Programming Language forever.

Articles

Get hired

There are many companies and start-ups looking for Go web developers with Iris experience as requirement, we are searching for you every day and we post those information via our facebook page, like the page to get notified, we have already posted some of them.

Sponsors

Thank you to all our sponsors! (please ask your company to also support this open source project by becoming a sponsor)

License

Iris is licensed under the 3-Clause BSD License. Iris is 100% free and open-source software.

For any questions regarding the license please send e-mail.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package typescript provides a typescript compiler with hot-reloader and optionally a cloud-based editor, called 'alm-tools'.
No description provided by the author
Package websocket provides rich websocket support for the iris web framework.

# Functions

Addr can be used as an argument for the `Run` method.
AutoTLS can be used as an argument for the `Run` method.
Default returns a new Application instance which, unlike `New`, recovers on panics and logs the incoming http requests.
DefaultConfiguration returns the default configuration for an iris station, fills the main Configuration.
Listener can be used as an argument for the `Run` method.
New creates and returns a fresh empty iris *Application instance.
Raw can be used as an argument for the `Run` method.
Server can be used as an argument for the `Run` method.
TLS can be used as an argument for the `Run` method.
TOML reads Configuration from a toml-compatible document file.
WithCharset sets the Charset setting.
WithConfiguration sets the "c" values to the framework's configurations.
WithOtherValue adds a value based on a key to the Other setting.
WithoutRemoteAddrHeader disables an existing request header name that can be used to validate the client's real IP.
WithoutServerError will cause to ignore the matched "errors" from the main application's `Run` function.
WithPostMaxMemory sets the maximum post data size that a client can send to the server, this differs from the overral request body size which can be modified by the `context#SetMaxRequestBodySize` or `iris#LimitRequestBodySize`.
WithRemoteAddrHeader enables or adds a new or existing request header name that can be used to validate the client's real IP.
WithTimeFormat sets the TimeFormat setting.
YAML reads Configuration from a configuration.yml file.

# Constants

HTTP Methods copied from `net/http`.
HTTP Methods copied from `net/http`.
HTTP Methods copied from `net/http`.
HTTP Methods copied from `net/http`.
MethodNone is an iris-specific "virtual" method to store the "offline" routes.
HTTP Methods copied from `net/http`.
HTTP Methods copied from `net/http`.
HTTP Methods copied from `net/http`.
HTTP Methods copied from `net/http`.
HTTP Methods copied from `net/http`.
NoLayout to disable layout for a particular template file A shortcut for the `view#NoLayout`.
RFC 7231, 6.3.3.
RFC 5842, 7.1.
RFC 7231, 6.6.3.
RFC 7231, 6.5.1.
RFC 7231, 6.5.8.
RFC 7231, 6.2.1.
RFC 7231, 6.3.2.
RFC 7231, 6.5.14.
RFC 4918, 11.4.
RFC 7231, 6.5.3.
RFC 7231, 6.4.3.
RFC 7231, 6.6.5.
RFC 7231, 6.5.9.
RFC 7231, 6.6.6.
RFC 3229, 10.4.1.
RFC 4918, 11.5.
RFC 7231, 6.6.1.
RFC 7231, 6.5.10.
RFC 4918, 11.3.
RFC 5842, 7.2.
RFC 7231, 6.5.5.
RFC 7231, 6.4.2.
RFC 7231, 6.4.1.
RFC 4918, 11.1.
RFC 6585, 6.
RFC 7231, 6.3.5.
RFC 7231, 6.3.4.
RFC 7231, 6.5.6.
RFC 2774, 7.
RFC 7231, 6.5.4.
RFC 7231, 6.6.2.
RFC 7232, 4.1.
RFC 7231, 6.3.1.
RFC 7233, 4.1.
RFC 7231, 6.5.2.
RFC 7538, 3.
RFC 7232, 4.2.
RFC 6585, 3.
RFC 2518, 10.1.
RFC 7235, 3.2.
RFC 7233, 4.4.
RFC 7231, 6.5.11.
RFC 6585, 5.
RFC 7231, 6.5.7.
RFC 7231, 6.5.12.
RFC 7231, 6.3.6.
RFC 7231, 6.4.4.
RFC 7231, 6.6.4.
RFC 7231, 6.2.2.
RFC 7168, 2.3.3.
RFC 7231, 6.4.7.
RFC 6585, 4.
RFC 7235, 3.1.
RFC 7725, 3.
RFC 4918, 11.2.
RFC 7231, 6.5.13.
RFC 7231, 6.5.15.
RFC 7231, 6.4.5.
RFC 2295, 8.1.

# Variables

Amber view engine.
Cache is a middleware providing cache functionalities to the next handlers, can be used as: `app.Get("/", iris.Cache, aboutHandler)`.
Django view engine.
ErrServerClosed is returned by the Server's Serve, ServeTLS, ListenAndServe, and ListenAndServeTLS methods after a call to Shutdown or Close.
FromStd converts native http.Handler, http.HandlerFunc & func(w, r, next) to context.Handler.
Gzip is a middleware which enables writing using gzip compression, if client supports.
Handlebars view engine.
HTML view engine.
LimitRequestBodySize is a middleware which sets a request body size limit for all next handlers in the chain.
Pug view engine.
RegisterOnInterrupt registers a global function to call when CTRL+C/CMD+C pressed or a unix kill command received.
StaticEmbeddedHandler returns a Handler which can serve embedded into executable files.
Version is the current version number of the Iris Web Framework.
WithFireMethodNotAllowed enanbles the FireMethodNotAllowed setting.
WithGlobalConfiguration will load the global yaml configuration file from the home directory and it will set/override the whole app's configuration to that file's contents.
WithOptimizations can force the application to optimize for the best performance where is possible.
WithoutAutoFireStatusCode disables the AutoFireStatusCode setting.
WithoutBanner is a conversion for the `WithoutStartupLog` option.
WithoutBodyConsumptionOnUnmarshal disables BodyConsumptionOnUnmarshal setting.
WithoutInterruptHandler disables the automatic graceful server shutdown when control/cmd+C pressed.
WithoutPathCorrection disables the PathCorrection setting.
WithoutStartupLog turns off the information send, once, to the terminal when the main server is open.
WithoutVersionChecker will disable the version checker and updater.
WithPathEscape enanbles the PathEscape setting.

# Structs

Application is responsible to manage the state of the application.
Configuration the whole configuration for an iris instance these can be passed via options also, look at the top of this file(configuration.go).

# Type aliases

Configurator is just an interface which accepts the framework instance.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Runner is just an interface which accepts the framework instance and returns an error.
No description provided by the author