1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +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

@@ -186,7 +186,7 @@ func main() {
// http://v1.localhost:8080/api/users
// http://v1.localhost:8080/api/users/42
// http://anything.localhost:8080
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}
func adminMiddleware(ctx iris.Context) {

View File

@@ -52,5 +52,5 @@ func main() {
// http://localhost:8080/api/v1/users
// http://localhost:8080/api/v1/users?admin=true
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}

View File

@@ -78,7 +78,7 @@ func main() {
ctx.View("hi.html")
})
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}
// should always print "($PATH) Handler is executing from 'MyContext'"

View File

@@ -99,5 +99,5 @@ func main() {
// GET: http://localhost:8080
// POST: http://localhost:8080/set
// GET: http://localhost:8080/get
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}

View File

@@ -98,5 +98,5 @@ func main() {
myCustomRouter := new(customRouter)
app.BuildRouter(app.ContextPool, myCustomRouter, app.APIBuilder, true)
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed))
}

View File

@@ -61,7 +61,7 @@ func main() {
// http://localhost:8080/css/main.css
// http://localhost:8080/profile/anyusername
// http://localhost:8080/other/random
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
// Note: In this example we just saw one use case,
// you may want to .WrapRouter or .Downgrade in order to bypass the iris' default router, i.e:

View File

@@ -289,5 +289,5 @@ func main() {
// should differ e.g.
// /path/{name:string}
// /path/{id:uint}
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}

View File

@@ -38,7 +38,7 @@ func main() {
// this will handle only GET "/other2/static"
app.Get("/other2/static2", staticPathOther2)
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed))
}
func h(ctx iris.Context) {

View File

@@ -38,7 +38,7 @@ func main() {
// http://localhost:8080/my500
// http://localhost:8080/u/gerasimos
// http://localhost:8080/product-problem
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}
func newProductProblem(productName, detail string) iris.Problem {

View File

@@ -72,5 +72,5 @@ func main() {
ctx.Writef("myparam's value (a trailing path parameter type) is: %#v\n", myparam)
})
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}

View File

@@ -177,5 +177,5 @@ func main() {
// FIRE NOT FOUND
http://localhost:8080/coudlntfound
*/
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}

View File

@@ -15,7 +15,7 @@ func main() {
app.Get("/newspaper", handler)
app.Get("/user/{id}", handler)
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}
func notFound(ctx iris.Context) {

View File

@@ -128,7 +128,7 @@ func main() {
// GET: http://admin.localhost:8080
// GET: http://admin.localhost:8080/settings
// GET: http://any_thing_here.localhost:8080
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}
func info(ctx iris.Context) {

View File

@@ -35,5 +35,5 @@ func main() {
//
// See view/template_html_4 example for more reverse routing examples
// using the reverse router component and the {{url}} and {{urlpath}} template functions.
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}

View File

@@ -41,5 +41,5 @@ func main() {
ctx.Exec("GET", "/invisible/iris")
})
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}

View File

@@ -29,7 +29,7 @@ func main() {
app.UseGlobal(before)
app.DoneGlobal(after)
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}
func before(ctx iris.Context) {

View File

@@ -38,7 +38,7 @@ are applied here as well.`)
ctx.Next() // call the done handlers.
})
app.Run(iris.Addr(":8080"))
app.Listen(":8080")
}
func before(ctx iris.Context) {