2016-10-01 09:03:06 +02:00
< p align = "center" >
2017-02-16 17:14:55 +01:00
< a href = "https://godoc.org/gopkg.in/kataras/iris.v6" >
2017-01-30 11:35:43 +01:00
< img width = "500" src = "https://raw.githubusercontent.com/kataras/iris/master/logo.jpg"
2017-02-07 01:37:35 +01:00
alt="Logo created by an Iris community member, https://github.com/OneebMalik"
title="Logo created by an Iris community member, https://github.com/OneebMalik">
2017-01-27 13:25:48 +01:00
< / a >
2016-07-25 19:28:44 +02:00
2016-10-01 09:03:06 +02:00
< br / >
2016-09-07 06:36:23 +02:00
2017-02-16 22:54:00 +01:00
< a href = "https://travis-ci.org/kataras/iris" > < img src = "https://api.travis-ci.org/kataras/iris.svg?branch=v6&style=flat-square" alt = "Build Status" > < / a >
2016-11-13 21:17:11 +01:00
2017-02-16 22:54:00 +01:00
< a href = "http://goreportcard.com/report/kataras/iris" > < img src = "https://img.shields.io/badge/report%20card%20-a%2B-F44336.svg?style=flat-square" alt = "http://goreportcard.com/report/kataras/iris" > < / a >
2016-10-01 09:03:06 +02:00
2017-02-16 22:54:00 +01:00
< a href = "https://golang.org" > < img src = "https://img.shields.io/badge/platform-any-ec2eb4.svg?style=flat-square" alt = "Runs everywhere" > < / a >
2017-02-16 17:14:55 +01:00
2017-02-17 04:08:19 +01:00
< a href = "https://golang.org" > < img src = "https://img.shields.io/badge/powered_by-go1.8-6362c2.svg?style=flat-square" alt = "Built with GoLang" > < / a >
2017-02-16 22:54:00 +01:00
< a href = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kataras2006%40hotmail%2ecom&lc=GR&item_name=Iris%20web%20framework&item_number=iriswebframeworkdonationid2016¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted" > < img src = "https://img.shields.io/badge/open-%20source-thisismycolor.svg?logo=data:image%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiPjxwYXRoIGZpbGw9InJnYigyMjAsMjIwLDIyMCkiIGQ9Ik04ODYuNiwzMDUuM2MtNDUuNywyMDMuMS0xODcsMzEwLjMtNDA5LjYsMzEwLjNoLTc0LjFsLTUxLjUsMzI2LjloLTYybC0zLjIsMjEuMWMtMi4xLDE0LDguNiwyNi40LDIyLjYsMjYuNGgxNTguNWMxOC44LDAsMzQuNy0xMy42LDM3LjctMzIuMmwxLjUtOGwyOS45LTE4OS4zbDEuOS0xMC4zYzIuOS0xOC42LDE4LjktMzIuMiwzNy43LTMyLjJoMjMuNWMxNTMuNSwwLDI3My43LTYyLjQsMzA4LjktMjQyLjdDOTIxLjYsNDA2LjgsOTE2LjcsMzQ4LjYsODg2LjYsMzA1LjN6Ii8%2BPHBhdGggZmlsbD0icmdiKDIyMCwyMjAsMjIwKSIgZD0iTTc5MS45LDgzLjlDNzQ2LjUsMzIuMiw2NjQuNCwxMCw1NTkuNSwxMEgyNTVjLTIxLjQsMC0zOS44LDE1LjUtNDMuMSwzNi44TDg1LDg1MWMtMi41LDE1LjksOS44LDMwLjIsMjUuOCwzMC4ySDI5OWw0Ny4zLTI5OS42bC0xLjUsOS40YzMuMi0yMS4zLDIxLjQtMzYuOCw0Mi45LTM2LjhINDc3YzE3NS41LDAsMzEzLTcxLjIsMzUzLjItMjc3LjVjMS4yLTYuMSwyLjMtMTIuMSwzLjEtMTcuOEM4NDUuMSwxODIuOCw4MzMuMiwxMzAuOCw3OTEuOSw4My45TDc5MS45LDgzLjl6Ii8%2BPC9zdmc%2B" alt = "Donation" > < / a >
< br / >
2017-02-16 23:09:04 +01:00
Iris is an efficient and well-designed toolbox with robust set of features.< br / > Write < b > your own< / b >
< b > perfect high-performance web applications< / b > < br / > with unlimited potentials and < b > portability< / b > .
< br / >
2016-10-01 09:03:06 +02:00
2017-02-16 17:14:55 +01:00
< / p >
2016-10-01 09:03:06 +02:00
2017-02-16 17:14:55 +01:00
< p >
2017-02-16 23:09:04 +01:00
< h1 > # Not YAWF<!-- hashtag, no title. --> < / h1 >
2017-02-17 03:46:33 +01:00
< a href = "https://github.com/kataras/iris/blob/v6/HISTORY.md" > < img src = "https://img.shields.io/badge/codename-√Ν εxτ%20-blue.svg?style=flat-square" alt = "CHANGELOG/HISTORY" > < / a >
2016-10-01 09:03:06 +02:00
2017-02-16 23:09:04 +01:00
< a href = "https://github.com/iris-contrib/examples" > < img src = "https://img.shields.io/badge/examples-%20repository-3362c2.svg?style=flat-square" alt = "Examples" > < / a >
2016-10-01 09:03:06 +02:00
2017-02-16 23:09:04 +01:00
< a href = "https://godoc.org/gopkg.in/kataras/iris.v6" > < img src = "https://img.shields.io/badge/docs-%20reference-5272B4.svg?style=flat-square" alt = "Docs" > < / a >
2016-10-01 09:03:06 +02:00
2017-02-16 23:09:04 +01:00
< a href = "https://kataras.rocket.chat/channel/iris" > < img src = "https://img.shields.io/badge/community-%20chat-00BCD4.svg?style=flat-square" alt = "Chat" > < / a >
2016-10-01 09:03:06 +02:00
2017-02-16 17:14:55 +01:00
< / p >
2017-01-13 08:36:52 +01:00
2017-01-26 08:50:26 +01:00
2017-02-17 06:15:32 +01:00
Iris is fully vendored. That means it is independent of any API changes in the used libraries and **will work seamlessly in the future** !
2017-01-26 08:50:26 +01:00
2017-02-17 06:15:32 +01:00
The size of the executable file is a critical part of the Application Deployment Process,
2017-02-16 17:14:55 +01:00
2017-02-17 06:15:32 +01:00
I made two very simple identical applications, the first written with a famous mini web framework named `gin` (=a Router, with logger, recover and pure Context out-of-the-box support) and the second in `iris`
(=every feature that you will need at the first place is bundled when you install Iris. Including sessions, websockets, typescript support, a cloud-editor, the view engine with 5 different template parsers, two Routers to select from, an end-to-end framework to test your API, more than 60 handy helpers via Context, complete rest API implementation, and cors, basicauth, internalization i18n, logger and recover middleware out-of-the-box).
2017-02-16 17:14:55 +01:00
2017-02-16 19:42:04 +01:00
I ran `go build` for both of them,
2017-02-16 17:14:55 +01:00
2017-02-16 19:42:04 +01:00
- the first had `9.029 KB` overall file size,
- the second had `8.505 KB` overall file size!
2017-02-17 06:15:32 +01:00
- net/http` had produced an executable file with `5.380 KB` size
2017-02-16 17:14:55 +01:00
2017-02-17 06:15:32 +01:00
> The app didn't used any third-party library. If you test the same thing I test and adapt other features like sessions and websockets then the size of `gin` and `net/http` could be doubled while `iris`' overall file size will remain almost the same.
2017-02-16 17:14:55 +01:00
2017-02-17 06:15:32 +01:00
**Applications that are written using Iris have smaller file sizes** than a single router library!
2017-02-16 19:42:04 +01:00
> Q: How is that possible?
> A: The Iris' vendor was done manually without any third-party tool. That means that I had the chance to remove any unnecessary code that Iris never uses internally.
2017-02-17 06:15:32 +01:00
Always follows the latest trends and best practices. Iris is the **Secret To Staying One Step Ahead of Your Competition** .
2017-02-16 19:42:04 +01:00
2017-02-17 06:15:32 +01:00
Iris is a high-performance tool, but it doesn't stops there. Performance depends on your application too, **Iris helps you to do the right choices** on every step.
2017-02-16 19:42:04 +01:00
2017-02-17 06:15:32 +01:00
**Familiar** and easy **API** . Sinatra-like REST API.
2017-02-16 19:42:04 +01:00
2017-02-17 06:15:32 +01:00
Contains examples and documentation for all its features.
2017-02-16 19:42:04 +01:00
2017-02-17 06:15:32 +01:00
Iris is a `low-level access` web framework, you always know what you're doing.
2017-02-16 19:42:04 +01:00
2017-02-17 06:15:32 +01:00
You'll **never miss a thing** from `net/http` , but if you do on some point, no problem because Iris is fully compatible with stdlib, you still have access to `http.ResponseWriter` and `http.Request` , you can adapt any third-party middleware of form `func(http.ResponseWriter, *http.Request, next http.HandlerFunc)` as well.
2017-02-16 19:42:04 +01:00
2017-02-17 06:15:32 +01:00
Iris is a community-driven project, **you suggest and I code** .
2017-02-16 17:14:55 +01:00
2017-02-17 06:15:32 +01:00
Unlike other repositories, this one is **very active** . When you post an issue, you get an answer at the next couple of minutes(hours at the worst). If you find a bug, **I am obliged to fix** that on the same day.
2017-02-16 22:54:00 +01:00
2017-02-16 17:14:55 +01:00
> Q: Why this framework is better than alternatives, does the author is, simply, better than other developers?
> A: Probably not, I don't think that I'm better than anyone else, I still learning every single day. The answer is that I have all the world's time to code for Iris the whole day, I don't have any obligations to anybody else, except you. I'd describe my self as a very dedicated FOSS developer.
Click the below animation to see what people say about Iris.
< a href = "https://www.youtube.com/watch?v=jGx0LkuUs4A" >
< img src = "https://github.com/iris-contrib/website/raw/gh-pages/assets/gif_link_to_yt2.gif" alt = "What people say" / >
< / a >
2016-12-11 06:50:03 +01:00
2017-02-05 19:26:40 +01:00
2017-01-25 21:19:06 +01:00
Installation
2016-12-14 10:57:07 +01:00
-----------
2016-10-01 09:03:06 +02:00
2017-02-17 06:15:32 +01:00
The only requirement is the [Go Programming Language ](https://golang.org/dl/ ), at least 1.8
2016-09-18 12:31:53 +02:00
2016-06-26 19:25:55 +02:00
```bash
2017-02-14 04:54:11 +01:00
$ go get gopkg.in/kataras/iris.v6
2016-10-02 13:59:04 +02:00
```
2017-02-05 19:26:40 +01:00
2017-01-28 10:38:20 +01:00
Overview
-----------
```go
package main
import (
2017-02-14 04:54:11 +01:00
"gopkg.in/kataras/iris.v6"
"gopkg.in/kataras/iris.v6/adaptors/view"
2017-02-17 00:34:45 +01:00
"gopkg.in/kataras/iris.v6/adaptors/httprouter"
2017-01-30 11:35:43 +01:00
)
2017-01-28 10:38:20 +01:00
2017-02-05 19:26:40 +01:00
func main() {
app := iris.New()
2017-02-14 04:54:11 +01:00
app.Adapt(iris.Devlogger()) // adapt a logger which prints all errors to the os.Stdout
app.Adapt(httprouter.New()) // adapt the adaptors/httprouter or adaptors/gorillamux
// 5 template engines are supported out-of-the-box:
2017-02-05 19:26:40 +01:00
//
// - standard html/template
// - amber
// - django
// - handlebars
// - pug(jade)
//
// Use the html standard engine for all files inside "./views" folder with extension ".html"
2017-02-14 04:54:11 +01:00
templates := view.HTML("./views", ".html")
app.Adapt(templates)
2017-02-05 19:26:40 +01:00
2017-02-14 04:54:11 +01:00
// http://localhost:6200
2017-02-05 19:26:40 +01:00
// Method: "GET"
// Render ./views/index.html
app.Get("/", func(ctx *iris.Context) {
ctx.Render("index.html", nil)
})
// Group routes, optionally: share middleware, template layout and custom http errors.
userAPI := app.Party("/users", userAPIMiddleware).
Layout("layouts/userLayout.html")
{
// Fire userNotFoundHandler when Not Found
2017-02-14 04:54:11 +01:00
// inside http://localhost:6200/users/*anything
2017-02-05 19:26:40 +01:00
userAPI.OnError(404, userNotFoundHandler)
2017-02-14 04:54:11 +01:00
// http://localhost:6200/users
2017-02-05 19:26:40 +01:00
// Method: "GET"
userAPI.Get("/", getAllHandler)
2017-02-14 04:54:11 +01:00
// http://localhost:6200/users/42
2017-02-05 19:26:40 +01:00
// Method: "GET"
userAPI.Get("/:id", getByIDHandler)
2017-02-14 04:54:11 +01:00
// http://localhost:6200/users
2017-02-05 19:26:40 +01:00
// Method: "POST"
userAPI.Post("/", saveUserHandler)
}
2017-02-14 04:54:11 +01:00
// Start the server at 127.0.0.1:6200
app.Listen(":6200")
2017-01-28 10:38:20 +01:00
}
2017-02-05 19:26:40 +01:00
func getByIDHandler(ctx *iris.Context) {
// take the :id from the path, parse to integer
// and set it to the new userID local variable.
userID, _ := ctx.ParamInt("id")
// userRepo, imaginary database service < - your only job .
user := userRepo.GetByID(userID)
// send back a response to the client,
// .JSON: content type as application/json; charset="utf-8"
// iris.StatusOK: with 200 http status code.
//
// send user as it is or make use of any json valid golang type,
// like the iris.Map{"username" : user.Username}.
ctx.JSON(iris.StatusOK, user)
}
2017-01-28 10:38:20 +01:00
```
2017-02-05 19:26:40 +01:00
> TIP: Execute `iris run main.go` to enable hot-reload on .go source code changes.
2017-02-14 04:54:11 +01:00
> TIP: Add `templates.Reload(true)` to monitor the template changes.
2017-01-28 10:38:20 +01:00
2017-01-25 21:19:06 +01:00
Documentation
-----------
2016-10-02 13:59:04 +02:00
2017-02-16 17:14:55 +01:00
< a href = "https://godoc.org/gopkg.in/kataras/iris.v6" > < img align = "right" width = "125" src = "https://raw.githubusercontent.com/iris-contrib/website/gh-pages/assets/book/cover_4.jpg" > < / a >
2016-10-02 13:59:04 +02:00
2017-02-14 05:01:15 +01:00
- The most important is to know where to find the [details ](https://godoc.org/gopkg.in/kataras/iris.v6 )
2017-02-14 04:54:11 +01:00
- Navigate through [examples ](https://github.com/iris-contrib/examples )
2016-10-02 13:59:04 +02:00
2017-02-14 04:54:11 +01:00
- [HISTORY.md ](https://github.com//kataras/iris/tree/v6/HISTORY.md ) file is your best friend.
2016-10-02 13:59:04 +02:00
2017-01-25 21:19:06 +01:00
Testing
2016-10-02 13:59:04 +02:00
------------
2017-01-25 21:19:06 +01:00
You can find RESTFUL test examples by navigating to the following links:
2016-10-02 13:59:04 +02:00
2017-02-17 00:34:45 +01:00
- [gavv/_examples/iris_test.go ](https://github.com/gavv/httpexpect/blob/master/_examples/iris_test.go )
- [./httptest/_example/main_test.go ](https://github.com/kataras/iris/blob/v6/httptest/_example/main_test.go )
2016-10-02 13:59:04 +02:00
2017-01-25 21:19:06 +01:00
FAQ
-----------
2016-10-02 13:59:04 +02:00
2017-01-25 21:19:06 +01:00
Explore [these questions ](https://github.com/kataras/iris/issues?q=label%3Aquestion ) and join to our [community chat][Chat]!
2016-10-01 09:03:06 +02:00
2016-05-30 16:08:09 +02:00
Philosophy
------------
2016-10-02 23:10:33 +02:00
The Iris philosophy is to provide robust tooling for HTTP, making it a great solution for single page applications, web sites, hybrids, or public HTTP APIs. Keep note that, today, iris is faster than nginx itself.
2016-05-30 16:08:09 +02:00
2017-01-25 21:19:06 +01:00
Iris does not force you to use any specific ORM or template engine. With support for the most used template engines (6+), you can quickly craft the perfect application.
2016-05-30 16:08:09 +02:00
2016-07-01 00:34:44 +02:00
2017-01-25 21:19:06 +01:00
People & Support
2016-05-30 16:08:09 +02:00
------------
2016-06-16 04:24:01 +02:00
2016-10-21 02:06:50 +02:00
The author of Iris is [@kataras ](https://github.com/kataras ).
2017-01-25 21:19:06 +01:00
The Success of Iris belongs to YOU with your bug reports and feature requests that made this Framework so Unique.
2016-05-30 16:08:09 +02:00
2017-01-25 21:19:06 +01:00
#### Who is kataras?
2016-05-30 16:08:09 +02:00
2017-01-25 21:19:06 +01:00
Hi, my name is Gerasimos Maropoulos and I'm the author of this project, let me put a few words about me.
2016-10-21 02:06:50 +02:00
2017-01-25 21:19:06 +01:00
I started to design Iris the night of the 13 March 2016, some weeks later, iris started to became famous and I have to fix many issues and implement new features, but I didn't have time to work on Iris because I had a part time job and the (software engineering) colleague which I studied.
2016-10-21 02:06:50 +02:00
2017-01-25 21:19:06 +01:00
I wanted to make iris' users proud of the framework they're using, so I decided to interrupt my studies and colleague, two days later I left from my part time job also.
2016-06-26 07:25:05 +02:00
2017-01-25 21:19:06 +01:00
Today I spend all my days and nights coding for Iris, and I'm happy about this, therefore I have zero incoming value.
2016-10-21 02:06:50 +02:00
2017-01-25 21:19:06 +01:00
- Star the project, will help you to follow the upcoming features.
- [Donate ](https://github.com/kataras/iris/blob/master/DONATIONS.md ), if you can afford any cost.
- Write an article about Iris or even post a Tweet.
2017-02-07 01:37:35 +01:00
- Do Pull Requests on the [iris-contrib ](https://github.com/iris-contrib ) organisation's repositories, like book and examples.
2016-12-13 07:41:30 +01:00
2017-01-25 21:19:06 +01:00
If you are interested in contributing to the Iris project, please see the document [CONTRIBUTING ](https://github.com/kataras/iris/blob/master/.github/CONTRIBUTING.md ).
2016-12-13 07:41:30 +01:00
Contact
------------
Besides the fact that we have a [community chat][Chat] for questions or reports and ideas, [stackoverflow ](http://stackoverflow.com/ ) section for generic go+iris questions and the [github issues ](https://github.com/kataras/iris/issues ) for bug reports and feature requests, you can also contact with me, as a person who is always open to help you:
- [Twitter ](https://twitter.com/MakisMaropoulos )
- [Facebook ](https://facebook.com/kataras.gopher )
2017-01-26 08:50:26 +01:00
- [Linkedin ](https://www.linkedin.com/in/gerasimos-maropoulos )
2016-12-13 07:41:30 +01:00
2017-01-25 21:19:06 +01:00
Versioning
------------
2017-02-17 03:46:33 +01:00
Current: **v6** , code-named as "√Ν εxτ"
2017-01-25 21:19:06 +01:00
v5: https://github.com/kataras/iris/tree/5.0.0
2016-12-13 07:41:30 +01:00
License
------------
2017-01-25 21:19:06 +01:00
Unless otherwise noted, the source files are distributed
2017-01-02 20:20:17 +01:00
under the MIT License found in the [LICENSE file ](LICENSE ).
2016-12-13 07:41:30 +01:00
2017-02-14 04:54:11 +01:00
Note that some optional components that you may use with Iris requires
different license agreements.
2016-07-03 16:21:57 +02:00
[Chat]: https://kataras.rocket.chat/channel/iris