1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-06 19:47:05 +00:00

examples: replace all app.Run(iris.Addr(...)) with app.Listen just for the shake of simplicity, both are doing the same exact thing as it's described on the http listening first example.

Former-commit-id: d20afb2e899aee658a8e0ed1693357798df93462
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-03-05 22:41:27 +02:00
parent b6445c7238
commit 0d26f24eb7
182 changed files with 202 additions and 227 deletions

View File

@@ -24,5 +24,5 @@ func main() {
// http://localhost:8080?referer=https://twitter.com/Xinterio/status/1023566830974251008
// http://localhost:8080?referer=https://www.google.com/search?q=Top+6+golang+web+frameworks&oq=Top+6+golang+web+frameworks
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed))
}

View File

@@ -19,7 +19,7 @@ func main() {
//
// The response should be:
// Received: main.config{Addr:"localhost:8080", ServerName:"Iris"}
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed), iris.WithOptimizations)
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed), iris.WithOptimizations)
}
func newApp() *iris.Application {

View File

@@ -19,7 +19,7 @@ func main() {
//
// The response should be:
// Received: main.config{Addr:"localhost:8080", ServerName:"Iris"}
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed), iris.WithOptimizations)
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed), iris.WithOptimizations)
}
func newApp() *iris.Application {

View File

@@ -40,5 +40,5 @@ func main() {
ctx.Writef("Username: %s", username)
})
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}

View File

@@ -118,7 +118,7 @@ func main() {
// This request will fail due to the empty `User.FirstName` (fname in json)
// and `User.LastName` (lname in json).
// Check your iris' application terminal output.
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed))
}
// UserStructLevelValidation contains custom struct level validations that don't always

View File

@@ -60,5 +60,5 @@ func main() {
//
// The response should be:
// Received: main.Company{Name:"iris-Go", City:"New York", Other:"Something here"}
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed), iris.WithOptimizations)
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed), iris.WithOptimizations)
}

View File

@@ -30,7 +30,7 @@ Check the terminal window for any queries logs.`)
// and ctx.GetBody methods the default golang and net/http behavior
// is to consume the readen data - they are not available on any next handlers in the chain -
// to change that behavior just pass the `WithoutBodyConsumptionOnUnmarshal` option.
app.Run(iris.Addr(":8080"), iris.WithoutBodyConsumptionOnUnmarshal)
app.Listen(":8080", iris.WithoutBodyConsumptionOnUnmarshal)
}
func logAllBody(ctx iris.Context) {

View File

@@ -25,5 +25,5 @@ func main() {
})
// http://localhost:8080?name=iris&age=3
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}

View File

@@ -20,7 +20,7 @@ func main() {
//
// The response should be:
// Received: main.person{XMLName:xml.Name{Space:"", Local:"person"}, Name:"Winston Churchill", Age:90, Description:"Description of this person, the body of this inner element."}
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed), iris.WithOptimizations)
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed), iris.WithOptimizations)
}
func newApp() *iris.Application {

View File

@@ -32,5 +32,5 @@ func handler(ctx iris.Context) {
func main() {
app := newApp()
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}

View File

@@ -61,5 +61,5 @@ func main() {
// http://localhost:8080/2
// http://lcoalhost:8080/notfoundhere
// see the output on the console.
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed))
}

View File

@@ -82,7 +82,7 @@ func main() {
// http://localhost:8080/1
// http://localhost:8080/2
// http://lcoalhost:8080/notfoundhere
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed))
}
var excludeExtensions = [...]string{

View File

@@ -35,7 +35,7 @@ func main() {
// http://localhost:8080/1
// http://localhost:8080/2
// http://lcoalhost:8080/notfoundhere
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed))
}
// get a filename based on the date, file logs works that way the most times

View File

@@ -124,5 +124,5 @@ func main() {
})
// start the server at http://localhost:8080 with post limit at 5 MB.
app.Run(iris.Addr(":8080") /* 0.*/, iris.WithPostMaxMemory(maxSize))
app.Listen(":8080" /* 0.*/, iris.WithPostMaxMemory(maxSize))
}

View File

@@ -72,7 +72,7 @@ func main() {
})
// start the server at http://localhost:8080 with post limit at 32 MB.
app.Run(iris.Addr(":8080"), iris.WithPostMaxMemory(32<<20))
app.Listen(":8080", iris.WithPostMaxMemory(32<<20))
}
func saveUploadedFile(fh *multipart.FileHeader, destDirectory string) (int64, error) {