kataras / iris

The fastest HTTP/2 Go Web Framework. New, modern and easy to learn. Fast development with Code you control. Unbeatable cost-performance ratio :rocket:
https://www.iris-go.com
BSD 3-Clause "New" or "Revised" License
25.04k stars 2.47k forks source link

net/http or fasthttp? #1288

Closed kiwi2019 closed 5 years ago

kiwi2019 commented 5 years ago

Is iris based on standard net/http or fasthttp? I see iris.go

func Addr(addr string, hostConfigs ...host.Configurator) Runner {
    return func(app *Application) error {
        return app.NewHost(&http.Server{Addr: addr}).
            Configure(hostConfigs...).
            ListenAndServe()
    }
}

it use http.Server is standard net/http!

How can I use the fasthttp ?

thanks...

kataras commented 5 years ago

Iris is based on net/http for more than two years now, if you want fasthttp take a look at the 5.0.0 branch but it is not supported any more, however, there is code inside that helps you understand and implement things like session manager, websockets, view managment and etc.

kiwi2019 commented 5 years ago

Iris is based on net/http for more than two years now, if you want fasthttp take a look at the 5.0.0 branch but it is not supported any more, however, there is code inside that helps you understand and implement things like session manager, websockets, view managment and etc.

ok, get it... Isn't fasthttp performance better? Why iris use net/http? What is the consideration? Finally, thank you very much...I use iris for my project ,it very easy to use and strong

kataras commented 5 years ago

I did explain when we moved from fasthttp to net/http at go 1.7. But in short: net/http supports http/2 and it does it very well, fasthttp does not. Secondly, many 3rd party libraries are written for net/http so you are able to use them with Iris (look the _examples repository's directory). However, the most important reason is that fasthttp is not maintained as it was anymore, the author of that library doesn't work on this project for a long time now, more than a whole year, valyala was really an experienced developer. Hope I answered your question.

kiwi2019 commented 5 years ago

Get it... Just as I thought! Thank you again... I wish iris better and better.

kataras commented 5 years ago

Thank YOU for using Iris, a new version will be released soon, with a lot of improvements and more features to use, stay tuned!