mirror of
https://github.com/kataras/iris.git
synced 2025-03-13 21:36:28 +01:00
Test code: nothing special here, remove the getRandomPort and use getRandomNumber for all
This commit is contained in:
parent
baec4d0fff
commit
1ff949b357
126
README.md
126
README.md
|
@ -29,7 +29,7 @@
|
|||
<a href="https://kataras.rocket.chat/channel/iris"><img src="https://img.shields.io/badge/%20community-chat-00BCD4.svg?style=flat-square" alt="Chat"></a><br/>
|
||||
<br/>
|
||||
|
||||
<b>Iris</b> is a well-known web application framework written in Go.
|
||||
<b>Iris</b> is the fastest back-end web framework written in Go.
|
||||
<br/>
|
||||
<b>Easy</b> to <a href="https://docs.iris-go.com">learn</a> while it's highly customizable,
|
||||
ideally suited for <br/> both experienced and novice developers.<br/><br/>
|
||||
|
@ -40,49 +40,52 @@ If you're coming from <a href="https://nodejs.org/en/">Node.js</a> world, this i
|
|||
<br/>
|
||||
|
||||
<br/>
|
||||
</p>
|
||||
<p>
|
||||
<img width="535" align="left" src="https://github.com/iris-contrib/website/raw/gh-pages/assets/chtree.jpg" />
|
||||
|
||||
This project started ~9 months ago<br/>
|
||||
and rapidly won your trust,<br/>
|
||||
I'm very thankful for this and<br/>
|
||||
I promise you that I'll continue to<br/>
|
||||
do my bests.<br/><br/>
|
||||
|
||||
All people, poor or rich, should give<br/>
|
||||
and share with each others.
|
||||
<br/><br/>
|
||||
As a person who knows<br/>
|
||||
how someone feels when opens<br/>
|
||||
the fridge and finds nothing to eat, again, <br/>
|
||||
I decided that all the <a href="https://github.com/kataras/iris/blob/master/DONATIONS.md">money you<br/>
|
||||
donated so far[<i>424 EUR</i>]</a>,<br/>
|
||||
and until the end of this month,<br/>
|
||||
<b>should go back to the people<br/>
|
||||
who need them most.</b><br/>
|
||||
Is not enough but...
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
CHRISTMAS IS MOST TRULY<br/>
|
||||
CHRISTMAS WHEN WE<br/>
|
||||
CELEBRATE IT BY GIVING THE<br/>
|
||||
LIGHT OF LOVE TO THOSE<br/>
|
||||
WHO NEED IT MOST.
|
||||
<br/><br/>
|
||||
~ Ruth Carter Stapleton
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<img src="https://raw.githubusercontent.com/smallnest/go-web-framework-benchmark/4db507a22c964c9bc9774c5b31afdc199a0fe8b7/benchmark.png" alt="Benchmark Wizzard July 21, 2016- Processing Time Horizontal Graph" />
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
Feature Overview
|
||||
-----------
|
||||
|
||||
- Focus on high performance
|
||||
- Automatically install and serve certificates from https://letsencrypt.org
|
||||
- Robust routing and middleware ecosystem
|
||||
- Build RESTful APIs
|
||||
- Group API's and subdomains with wildcard support
|
||||
- Body binding for JSON, XML, Forms, can be extended to use your own custom binders
|
||||
- More than 50 handy functions to send HTTP responses
|
||||
- View system: supporting more than 6+ template engines, with prerenders. You can still use your favorite
|
||||
- Define virtual hosts and (wildcard) subdomains with path level routing
|
||||
- Graceful shutdown
|
||||
- Limit request body
|
||||
- Localization i18N
|
||||
- Serve static files
|
||||
- Cache
|
||||
- Log requests
|
||||
- Customizable format and output for the logger
|
||||
- Customizable HTTP errors
|
||||
- Compression (Gzip)
|
||||
- Authentication
|
||||
- OAuth, OAuth2 supporting 27+ popular websites
|
||||
- JWT
|
||||
- Basic Authentication
|
||||
- HTTP Sessions
|
||||
- Add / Remove trailing slash from the URL with option to redirect
|
||||
- Redirect requests
|
||||
- HTTP to HTTPS
|
||||
- HTTP to HTTPS WWW
|
||||
- HTTP to HTTPS non WWW
|
||||
- Non WWW to WWW
|
||||
- WWW to non WWW
|
||||
- Highly scalable rich content render (Markdown, JSON, JSONP, XML...)
|
||||
- Websocket-only API similar to socket.io
|
||||
- Hot Reload on source code changes
|
||||
- Typescript integration + Web IDE
|
||||
- Checks for updates at startup
|
||||
- Highly customizable
|
||||
- Feels like you used iris forever, thanks to its Fluent API
|
||||
- And many others...
|
||||
|
||||
Quick Start
|
||||
-----------
|
||||
|
@ -134,6 +137,49 @@ $ go run hellojson.go
|
|||
|
||||
Open your browser or any other http client at http://localhost:5700/api/user/42.
|
||||
|
||||
### Merry Christmas!
|
||||
|
||||
<p>
|
||||
|
||||
<img width="535" align="left" src="https://github.com/iris-contrib/website/raw/gh-pages/assets/chtree.jpg" />
|
||||
|
||||
This project started ~9 months ago<br/>
|
||||
and rapidly won your trust,<br/>
|
||||
I'm very thankful for this and<br/>
|
||||
I promise you that I'll continue to<br/>
|
||||
do my bests.<br/><br/>
|
||||
|
||||
All people, poor or rich, should give<br/>
|
||||
and share with each others.
|
||||
<br/><br/>
|
||||
As a person who knows<br/>
|
||||
how someone feels when opens<br/>
|
||||
the fridge and finds nothing to eat, again, <br/>
|
||||
I decided that all the <a href="https://github.com/kataras/iris/blob/master/DONATIONS.md">money you<br/>
|
||||
donated so far[<i>424 EUR</i>]</a>,<br/>
|
||||
and until the end of this month,<br/>
|
||||
<b>should go back to the people<br/>
|
||||
who need them most.</b><br/>
|
||||
Is not enough but...
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
CHRISTMAS IS MOST TRULY<br/>
|
||||
CHRISTMAS WHEN WE<br/>
|
||||
CELEBRATE IT BY GIVING THE<br/>
|
||||
LIGHT OF LOVE TO THOSE<br/>
|
||||
WHO NEED IT MOST.
|
||||
<br/><br/>
|
||||
~ Ruth Carter Stapleton
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
### New
|
||||
|
||||
```go
|
||||
|
|
19
http_test.go
19
http_test.go
|
@ -152,12 +152,6 @@ func getRandomNumber(min int, max int) int {
|
|||
return rand.Intn(max-min) + min
|
||||
}
|
||||
|
||||
func getRandomPort() int {
|
||||
min := 6666
|
||||
max := 7777
|
||||
return getRandomNumber(min, max)
|
||||
}
|
||||
|
||||
// works as
|
||||
// defer listenTLS(iris.Default, hostTLS)()
|
||||
func listenTLS(api *iris.Framework, hostTLS string) func() {
|
||||
|
@ -201,13 +195,13 @@ func TestMultiRunningServers_v1_PROXY(t *testing.T) {
|
|||
iris.ResetDefault()
|
||||
|
||||
host := "localhost" // you have to add it to your hosts file( for windows, as 127.0.0.1 mydomain.com)
|
||||
hostTLS := host + ":" + strconv.Itoa(getRandomPort())
|
||||
hostTLS := host + ":" + strconv.Itoa(getRandomNumber(8886, 8889))
|
||||
|
||||
iris.Get("/", func(ctx *iris.Context) {
|
||||
ctx.Write("Hello from %s", hostTLS)
|
||||
})
|
||||
|
||||
proxyHost := host + ":" + strconv.Itoa(getRandomNumber(3333, 4444))
|
||||
proxyHost := host + ":" + strconv.Itoa(getRandomNumber(3300, 3332))
|
||||
closeProxy := iris.Proxy(proxyHost, "https://"+hostTLS)
|
||||
defer closeProxy()
|
||||
|
||||
|
@ -225,7 +219,7 @@ func TestMultiRunningServers_v2(t *testing.T) {
|
|||
iris.ResetDefault()
|
||||
|
||||
domain := "localhost"
|
||||
hostTLS := domain + ":" + strconv.Itoa(getRandomPort())
|
||||
hostTLS := domain + ":" + strconv.Itoa(getRandomNumber(3333, 4444))
|
||||
srv1Host := domain + ":" + strconv.Itoa(getRandomNumber(4446, 5444))
|
||||
srv2Host := domain + ":" + strconv.Itoa(getRandomNumber(7778, 8887))
|
||||
|
||||
|
@ -233,11 +227,6 @@ func TestMultiRunningServers_v2(t *testing.T) {
|
|||
ctx.Write("Hello from %s", hostTLS)
|
||||
})
|
||||
|
||||
// add a secondary server
|
||||
//Servers.Add(ServerConfiguration{ListeningAddr: domain + ":80", RedirectTo: "https://" + host, Virtual: true})
|
||||
// add our primary/main server
|
||||
//Servers.Add(ServerConfiguration{ListeningAddr: host, CertFile: certFile.Name(), KeyFile: keyFile.Name(), Virtual: true})
|
||||
|
||||
// using the proxy handler
|
||||
fsrv1 := &fasthttp.Server{Handler: iris.ProxyHandler(srv1Host, "https://"+hostTLS)}
|
||||
go fsrv1.ListenAndServe(srv1Host)
|
||||
|
@ -394,7 +383,7 @@ func TestMuxSimpleParty(t *testing.T) {
|
|||
p.Get("/namedpath/:param1/something/:param2/else", h)
|
||||
}
|
||||
|
||||
iris.Default.Config.VHost = "0.0.0.0:" + strconv.Itoa(getRandomPort())
|
||||
iris.Default.Config.VHost = "0.0.0.0:" + strconv.Itoa(getRandomNumber(2222, 2399))
|
||||
// iris.Default.Config.Tester.Debug = true
|
||||
// iris.Default.Config.Tester.ExplicitURL = true
|
||||
e := httptest.New(iris.Default, t)
|
||||
|
|
Loading…
Reference in New Issue
Block a user