diff --git a/README_ES.md b/README_ES.md index 28d06057..4f037d32 100644 --- a/README_ES.md +++ b/README_ES.md @@ -33,7 +33,7 @@ func main() { }) }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` diff --git a/README_FA.md b/README_FA.md index b3310677..6ec32b13 100644 --- a/README_FA.md +++ b/README_FA.md @@ -48,7 +48,7 @@ func main() { }) }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` diff --git a/README_GR.md b/README_GR.md index 5ef819fa..295e357a 100644 --- a/README_GR.md +++ b/README_GR.md @@ -33,7 +33,7 @@ func main() { }) }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` diff --git a/README_KO.md b/README_KO.md index 5082f636..2dffbaa9 100644 --- a/README_KO.md +++ b/README_KO.md @@ -31,7 +31,7 @@ func main() { }) }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` diff --git a/README_RU.md b/README_RU.md index c1905928..53a16b2c 100644 --- a/README_RU.md +++ b/README_RU.md @@ -31,7 +31,7 @@ func main() { }) }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` diff --git a/README_ZH.md b/README_ZH.md index 1bf2076f..09ca9831 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -31,7 +31,7 @@ func main() { }) }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` diff --git a/_benchmarks/iris-mvc-templates/main.go b/_benchmarks/iris-mvc-templates/main.go index a572810f..9c96e904 100644 --- a/_benchmarks/iris-mvc-templates/main.go +++ b/_benchmarks/iris-mvc-templates/main.go @@ -24,7 +24,7 @@ func main() { mvc.New(app).Handle(new(controllers.HomeController)) - app.Run(iris.Addr(":5000")) + app.Listen(":5000") } type err struct { diff --git a/_benchmarks/iris-sessions/main.go b/_benchmarks/iris-sessions/main.go index f84e1f07..c380b3fe 100644 --- a/_benchmarks/iris-sessions/main.go +++ b/_benchmarks/iris-sessions/main.go @@ -24,7 +24,7 @@ func main() { app.Delete("/del", delHandler) */ - app.Run(iris.Addr(":5000")) + app.Listen(":5000") } // Set and Get diff --git a/_examples/README_ZH.md b/_examples/README_ZH.md index 865557f8..8afcea4e 100644 --- a/_examples/README_ZH.md +++ b/_examples/README_ZH.md @@ -153,7 +153,7 @@ import ( func main() { app := iris.New() mvc.Configure(app.Party("/root"), myMVC) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func myMVC(app *mvc.Application) { diff --git a/_examples/apidoc/yaag/main.go b/_examples/apidoc/yaag/main.go index 2a69a211..a50b346c 100644 --- a/_examples/apidoc/yaag/main.go +++ b/_examples/apidoc/yaag/main.go @@ -51,5 +51,5 @@ func main() { // // Example usage: // Visit all paths and open the generated "apidoc.html" file to see the API's automated docs. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/authentication/basicauth/main.go b/_examples/authentication/basicauth/main.go index 643d3e03..cfc279f0 100644 --- a/_examples/authentication/basicauth/main.go +++ b/_examples/authentication/basicauth/main.go @@ -45,7 +45,7 @@ func newApp() *iris.Application { func main() { app := newApp() // open http://localhost:8080/admin - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func h(ctx iris.Context) { diff --git a/_examples/authentication/oauth2/main.go b/_examples/authentication/oauth2/main.go index b16702d5..4bf638e3 100644 --- a/_examples/authentication/oauth2/main.go +++ b/_examples/authentication/oauth2/main.go @@ -400,7 +400,7 @@ func main() { }) // http://localhost:3000 - app.Run(iris.Addr("localhost:3000")) + app.Listen("localhost:3000") } type ProviderIndex struct { diff --git a/_examples/cache/client-side/main.go b/_examples/cache/client-side/main.go index 31e7aefe..f460b463 100644 --- a/_examples/cache/client-side/main.go +++ b/_examples/cache/client-side/main.go @@ -30,7 +30,7 @@ func main() { // }) app.Get("/", greet) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func greet(ctx iris.Context) { diff --git a/_examples/cache/simple/main.go b/_examples/cache/simple/main.go index 49e46567..010c3511 100644 --- a/_examples/cache/simple/main.go +++ b/_examples/cache/simple/main.go @@ -63,7 +63,7 @@ func main() { // saves its content on the first request and serves it instead of re-calculating the content. // After 10 seconds it will be cleared and reset. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func writeMarkdown(ctx iris.Context) { diff --git a/_examples/configuration/README.md b/_examples/configuration/README.md index 6cfad96b..3fae71e5 100644 --- a/_examples/configuration/README.md +++ b/_examples/configuration/README.md @@ -26,7 +26,7 @@ func main() { // [...] // Good when you want to modify the whole configuration. - app.Run(iris.Addr(":8080"), iris.WithConfiguration(iris.Configuration{ + app.Listen(":8080", iris.WithConfiguration(iris.Configuration{ DisableStartupLog: false, DisableInterruptHandler: false, DisablePathCorrection: false, @@ -60,11 +60,11 @@ func main() { // Prefix: "With", code editors will help you navigate through all // configuration options without even a glitch to the documentation. - app.Run(iris.Addr(":8080"), iris.WithoutStartupLog, iris.WithCharset("UTF-8")) + app.Listen(":8080", iris.WithoutStartupLog, iris.WithCharset("UTF-8")) // or before run: // app.Configure(iris.WithoutStartupLog, iris.WithCharset("UTF-8")) - // app.Run(iris.Addr(":8080")) + // app.Listen(":8080") } ``` @@ -99,7 +99,7 @@ func main() { // [...] // Good when you have two configurations, one for development and a different one for production use. - app.Run(iris.Addr(":8080"), iris.WithConfiguration(iris.TOML("./configs/iris.tml"))) + app.Listen(":8080", iris.WithConfiguration(iris.TOML("./configs/iris.tml"))) } ``` @@ -129,7 +129,7 @@ func main() { }) // [...] - app.Run(iris.Addr(":8080"), iris.WithConfiguration(iris.YAML("./configs/iris.yml"))) + app.Listen(":8080", iris.WithConfiguration(iris.YAML("./configs/iris.yml"))) } ``` @@ -141,7 +141,7 @@ func main() { // from the main application's `Run` function. // // Usage: -// err := app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) +// err := app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) // will return `nil` if the server's error was `http/iris#ErrServerClosed`. // // See `Configuration#IgnoreServerErrors []string` too. @@ -278,6 +278,6 @@ func main() { app := iris.New() app.Configure(counter.Configurator) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` \ No newline at end of file diff --git a/_examples/configuration/from-configuration-structure/main.go b/_examples/configuration/from-configuration-structure/main.go index 540c0e7d..6e0d0a3a 100644 --- a/_examples/configuration/from-configuration-structure/main.go +++ b/_examples/configuration/from-configuration-structure/main.go @@ -12,7 +12,7 @@ func main() { // [...] // Good when you want to modify the whole configuration. - app.Run(iris.Addr(":8080"), iris.WithConfiguration(iris.Configuration{ // default configuration: + app.Listen(":8080", iris.WithConfiguration(iris.Configuration{ // default configuration: DisableStartupLog: false, DisableInterruptHandler: false, DisablePathCorrection: false, diff --git a/_examples/configuration/from-toml-file/main.go b/_examples/configuration/from-toml-file/main.go index fe824489..b0c02935 100644 --- a/_examples/configuration/from-toml-file/main.go +++ b/_examples/configuration/from-toml-file/main.go @@ -13,9 +13,9 @@ func main() { // [...] // Good when you have two configurations, one for development and a different one for production use. - app.Run(iris.Addr(":8080"), iris.WithConfiguration(iris.TOML("./configs/iris.tml"))) + app.Listen(":8080", iris.WithConfiguration(iris.TOML("./configs/iris.tml"))) // or before run: // app.Configure(iris.WithConfiguration(iris.TOML("./configs/iris.tml"))) - // app.Run(iris.Addr(":8080")) + // app.Listen(":8080") } diff --git a/_examples/configuration/from-yaml-file/main.go b/_examples/configuration/from-yaml-file/main.go index 3092ed2d..452bf2c7 100644 --- a/_examples/configuration/from-yaml-file/main.go +++ b/_examples/configuration/from-yaml-file/main.go @@ -14,9 +14,9 @@ func main() { // Good when you have two configurations, one for development and a different one for production use. // If iris.YAML's input string argument is "~" then it loads the configuration from the home directory // and can be shared between many iris instances. - app.Run(iris.Addr(":8080"), iris.WithConfiguration(iris.YAML("./configs/iris.yml"))) + app.Listen(":8080", iris.WithConfiguration(iris.YAML("./configs/iris.yml"))) // or before run: // app.Configure(iris.WithConfiguration(iris.YAML("./configs/iris.yml"))) - // app.Run(iris.Addr(":8080")) + // app.Listen(":8080") } diff --git a/_examples/configuration/from-yaml-file/shared-configuration/main.go b/_examples/configuration/from-yaml-file/shared-configuration/main.go index 1b56e5b4..483cd7a5 100644 --- a/_examples/configuration/from-yaml-file/shared-configuration/main.go +++ b/_examples/configuration/from-yaml-file/shared-configuration/main.go @@ -14,8 +14,8 @@ func main() { // Good when you share configuration between multiple iris instances. // This configuration file lives in your $HOME/iris.yml for unix hosts // or %HOMEDRIVE%+%HOMEPATH%/iris.yml for windows hosts, and you can modify it. - app.Run(iris.Addr(":8080"), iris.WithGlobalConfiguration) + app.Listen(":8080", iris.WithGlobalConfiguration) // or before run: // app.Configure(iris.WithGlobalConfiguration) - // app.Run(iris.Addr(":8080")) + // app.Listen(":8080") } diff --git a/_examples/configuration/functional/main.go b/_examples/configuration/functional/main.go index 674b2330..5eb82c99 100644 --- a/_examples/configuration/functional/main.go +++ b/_examples/configuration/functional/main.go @@ -15,9 +15,9 @@ func main() { // Prefix: "With", code editors will help you navigate through all // configuration options without even a glitch to the documentation. - app.Run(iris.Addr(":8080"), iris.WithoutStartupLog, iris.WithCharset("UTF-8")) + app.Listen(":8080", iris.WithoutStartupLog, iris.WithCharset("UTF-8")) // or before run: // app.Configure(iris.WithoutStartupLog, iris.WithCharset("UTF-8")) - // app.Run(iris.Addr(":8080")) + // app.Listen(":8080") } diff --git a/_examples/convert-handlers/negroni-like/main.go b/_examples/convert-handlers/negroni-like/main.go index b1650605..ff67100b 100644 --- a/_examples/convert-handlers/negroni-like/main.go +++ b/_examples/convert-handlers/negroni-like/main.go @@ -26,7 +26,7 @@ func main() { // http://localhost:8080 // http://localhost:8080/ok - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func negronilikeTestMiddleware(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { diff --git a/_examples/convert-handlers/nethttp/main.go b/_examples/convert-handlers/nethttp/main.go index fee83c8f..d56ccd8f 100644 --- a/_examples/convert-handlers/nethttp/main.go +++ b/_examples/convert-handlers/nethttp/main.go @@ -23,7 +23,7 @@ func main() { // http://localhost:8080 // http://localhost:8080/ok - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func nativeTestMiddleware(w http.ResponseWriter, r *http.Request) { diff --git a/_examples/convert-handlers/real-usecase-raven/wrapping-the-router/main.go b/_examples/convert-handlers/real-usecase-raven/wrapping-the-router/main.go index 288dc8f7..8abc1a53 100644 --- a/_examples/convert-handlers/real-usecase-raven/wrapping-the-router/main.go +++ b/_examples/convert-handlers/real-usecase-raven/wrapping-the-router/main.go @@ -41,5 +41,5 @@ func main() { irisRouter(w, r) }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/convert-handlers/real-usecase-raven/writing-middleware/main.go b/_examples/convert-handlers/real-usecase-raven/writing-middleware/main.go index e40f63b9..82ef598b 100644 --- a/_examples/convert-handlers/real-usecase-raven/writing-middleware/main.go +++ b/_examples/convert-handlers/real-usecase-raven/writing-middleware/main.go @@ -53,5 +53,5 @@ func main() { ctx.Writef("Hi") }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/cookies/basic/main.go b/_examples/cookies/basic/main.go index 4bf5796c..f9b789e3 100644 --- a/_examples/cookies/basic/main.go +++ b/_examples/cookies/basic/main.go @@ -60,5 +60,5 @@ func main() { // GET: http://localhost:8080/cookies/my_name/my_value // GET: http://localhost:8080/cookies/my_name // DELETE: http://localhost:8080/cookies/my_name - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/cookies/securecookie/main.go b/_examples/cookies/securecookie/main.go index a355bdb2..40ee7052 100644 --- a/_examples/cookies/securecookie/main.go +++ b/_examples/cookies/securecookie/main.go @@ -55,5 +55,5 @@ func newApp() *iris.Application { func main() { app := newApp() - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/desktop-app/blink/main.go b/_examples/desktop-app/blink/main.go index 45972879..a771727f 100644 --- a/_examples/desktop-app/blink/main.go +++ b/_examples/desktop-app/blink/main.go @@ -23,7 +23,7 @@ func runServer() { app.Get("/", func(ctx iris.Context) { ctx.HTML("

Hello Desktop

") }) - app.Run(iris.Addr(addr)) + app.Listen(addr) } func showAndWaitWindow() { diff --git a/_examples/desktop-app/lorca/main.go b/_examples/desktop-app/lorca/main.go index aa191dd5..eb5fe18f 100644 --- a/_examples/desktop-app/lorca/main.go +++ b/_examples/desktop-app/lorca/main.go @@ -21,7 +21,7 @@ func runServer() { app.Get("/", func(ctx iris.Context) { ctx.HTML("My App

Hello Desktop

") }) - app.Run(iris.Addr(addr)) + app.Listen(addr) } func showAndWaitWindow() { diff --git a/_examples/desktop-app/webview/main.go b/_examples/desktop-app/webview/main.go index 3c211139..6e2bb34b 100644 --- a/_examples/desktop-app/webview/main.go +++ b/_examples/desktop-app/webview/main.go @@ -30,7 +30,7 @@ func runServer() { app.Get("/", func(ctx iris.Context) { ctx.HTML("

Hello Desktop

") }) - app.Run(iris.Addr(addr)) + app.Listen(addr) } func showAndWaitWindow() { diff --git a/_examples/docker/main.go b/_examples/docker/main.go index 521f1126..ae433515 100644 --- a/_examples/docker/main.go +++ b/_examples/docker/main.go @@ -22,5 +22,5 @@ func main() { ctx.Writef("id: %d", ctx.Params().GetUintDefault("id", 0)) }) - app.Run(iris.Addr(*addr)) + app.Listen(*addr) } diff --git a/_examples/experimental-handlers/casbin/middleware/main.go b/_examples/experimental-handlers/casbin/middleware/main.go index 5d26e920..09b41dc0 100644 --- a/_examples/experimental-handlers/casbin/middleware/main.go +++ b/_examples/experimental-handlers/casbin/middleware/main.go @@ -35,7 +35,7 @@ func newApp() *iris.Application { func main() { app := newApp() - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func hi(ctx iris.Context) { diff --git a/_examples/experimental-handlers/casbin/wrapper/main.go b/_examples/experimental-handlers/casbin/wrapper/main.go index dffac88d..dbc851a4 100644 --- a/_examples/experimental-handlers/casbin/wrapper/main.go +++ b/_examples/experimental-handlers/casbin/wrapper/main.go @@ -35,7 +35,7 @@ func newApp() *iris.Application { func main() { app := newApp() - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func hi(ctx iris.Context) { diff --git a/_examples/experimental-handlers/cloudwatch/simple/main.go b/_examples/experimental-handlers/cloudwatch/simple/main.go index 4cc71f26..134db6c0 100644 --- a/_examples/experimental-handlers/cloudwatch/simple/main.go +++ b/_examples/experimental-handlers/cloudwatch/simple/main.go @@ -46,5 +46,5 @@ func main() { // http://localhost:8080 // should give: NoCredentialProviders // which is correct, you have to authorize your aws, we asumme that you know how to. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/experimental-handlers/cors/simple/client/main.go b/_examples/experimental-handlers/cors/simple/client/main.go index 03f7db49..bf551f30 100644 --- a/_examples/experimental-handlers/cors/simple/client/main.go +++ b/_examples/experimental-handlers/cors/simple/client/main.go @@ -34,5 +34,5 @@ func main() { // Start and navigate to http://localhost:8080 // and go to the previous terminal of your running cors/simple/main.go server // and see the logs. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/experimental-handlers/cors/simple/main.go b/_examples/experimental-handlers/cors/simple/main.go index 90b2b37e..61eba676 100644 --- a/_examples/experimental-handlers/cors/simple/main.go +++ b/_examples/experimental-handlers/cors/simple/main.go @@ -46,9 +46,8 @@ func main() { // iris.WithoutPathCorrectionRedirection | iris#Configuration.DisablePathCorrectionRedirection: // CORS needs the allow origin headers in the redirect response as well, we have a solution for this: - // If you use iris >= v11.0.4 then add the `app.Run(..., iris.WithoutPathCorrectionRedirection)` - // on the server side if you wish + // Add the iris.WithoutPathCorrectionRedirection option // to directly fire the handler instead of redirection (which is the default behavior) // on request paths like "/v1/mailer/" when "/v1/mailer" route handler is registered. - app.Run(iris.Addr(":80"), iris.WithoutPathCorrectionRedirection) + app.Listen(":80", iris.WithoutPathCorrectionRedirection) } diff --git a/_examples/experimental-handlers/csrf/main.go b/_examples/experimental-handlers/csrf/main.go index b1bff1aa..2a08814c 100644 --- a/_examples/experimental-handlers/csrf/main.go +++ b/_examples/experimental-handlers/csrf/main.go @@ -35,7 +35,7 @@ func main() { // GET: http://localhost:8080/user/signup // POST: http://localhost:8080/user/signup - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func getSignupForm(ctx iris.Context) { diff --git a/_examples/experimental-handlers/jwt/main.go b/_examples/experimental-handlers/jwt/main.go index 878ffc86..9fe4cb91 100644 --- a/_examples/experimental-handlers/jwt/main.go +++ b/_examples/experimental-handlers/jwt/main.go @@ -52,5 +52,5 @@ func main() { app.Get("/", getTokenHandler) app.Get("/secured", j.Serve, myAuthenticatedHandler) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/experimental-handlers/newrelic/simple/main.go b/_examples/experimental-handlers/newrelic/simple/main.go index 28d3e1e2..dbd0d558 100644 --- a/_examples/experimental-handlers/newrelic/simple/main.go +++ b/_examples/experimental-handlers/newrelic/simple/main.go @@ -20,5 +20,5 @@ func main() { ctx.Writef("success!\n") }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/experimental-handlers/prometheus/simple/main.go b/_examples/experimental-handlers/prometheus/simple/main.go index 2cc53ab5..6c2011d2 100644 --- a/_examples/experimental-handlers/prometheus/simple/main.go +++ b/_examples/experimental-handlers/prometheus/simple/main.go @@ -35,5 +35,5 @@ func main() { // http://localhost:8080/ // http://localhost:8080/anotfound // http://localhost:8080/metrics - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/experimental-handlers/secure/simple/main.go b/_examples/experimental-handlers/secure/simple/main.go index 64359dde..be86a876 100644 --- a/_examples/experimental-handlers/secure/simple/main.go +++ b/_examples/experimental-handlers/secure/simple/main.go @@ -34,5 +34,5 @@ func main() { ctx.Writef("Hello from /home") }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/experimental-handlers/tollboothic/limit-handler/main.go b/_examples/experimental-handlers/tollboothic/limit-handler/main.go index 2e878136..db52dcad 100644 --- a/_examples/experimental-handlers/tollboothic/limit-handler/main.go +++ b/_examples/experimental-handlers/tollboothic/limit-handler/main.go @@ -25,7 +25,7 @@ func main() { ctx.HTML("Hello, world!") }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } // Read more at: https://github.com/didip/tollbooth diff --git a/_examples/file-server/basic/main.go b/_examples/file-server/basic/main.go index e15ceec6..e261239e 100644 --- a/_examples/file-server/basic/main.go +++ b/_examples/file-server/basic/main.go @@ -48,5 +48,5 @@ func newApp() *iris.Application { func main() { app := newApp() - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/file-server/embedding-files-into-app/main.go b/_examples/file-server/embedding-files-into-app/main.go index 143dcc69..1b239cf8 100644 --- a/_examples/file-server/embedding-files-into-app/main.go +++ b/_examples/file-server/embedding-files-into-app/main.go @@ -32,5 +32,5 @@ func main() { // http://localhost:8080/static/css/bootstrap.min.css // http://localhost:8080/static/js/jquery-2.1.1.js // http://localhost:8080/static/favicon.ico - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/file-server/embedding-gziped-files-into-app/main.go b/_examples/file-server/embedding-gziped-files-into-app/main.go index 8e2041e0..f6501fca 100644 --- a/_examples/file-server/embedding-gziped-files-into-app/main.go +++ b/_examples/file-server/embedding-gziped-files-into-app/main.go @@ -32,5 +32,5 @@ func main() { // http://localhost:8080/static/css/bootstrap.min.css // http://localhost:8080/static/js/jquery-2.1.1.js // http://localhost:8080/static/favicon.ico - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/file-server/favicon/main.go b/_examples/file-server/favicon/main.go index 9f84649c..f10f6088 100644 --- a/_examples/file-server/favicon/main.go +++ b/_examples/file-server/favicon/main.go @@ -20,5 +20,5 @@ func main() { so iris serves your favicon in that path too (you can change it).`) }) // if favicon doesn't show to you, try to clear your browser's cache. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/file-server/send-files/main.go b/_examples/file-server/send-files/main.go index 709750f7..bc03b0a1 100644 --- a/_examples/file-server/send-files/main.go +++ b/_examples/file-server/send-files/main.go @@ -12,5 +12,5 @@ func main() { ctx.SendFile(file, "c.zip") }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/file-server/single-page-application/basic/main.go b/_examples/file-server/single-page-application/basic/main.go index 4d86e164..89a19a13 100644 --- a/_examples/file-server/single-page-application/basic/main.go +++ b/_examples/file-server/single-page-application/basic/main.go @@ -32,5 +32,5 @@ func main() { // http://localhost:8080/index.html // http://localhost:8080/app.js // http://localhost:8080/css/main.css - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/file-server/single-page-application/embedded-single-page-application-with-other-routes/main.go b/_examples/file-server/single-page-application/embedded-single-page-application-with-other-routes/main.go index 61070633..3fd55e6f 100644 --- a/_examples/file-server/single-page-application/embedded-single-page-application-with-other-routes/main.go +++ b/_examples/file-server/single-page-application/embedded-single-page-application-with-other-routes/main.go @@ -61,5 +61,5 @@ func main() { // http://localhost:8080/.well-known/metrics // // Remember: we could use the root wildcard `app.Get("/{param:path}")` and serve the files manually as well. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/file-server/single-page-application/embedded-single-page-application/main.go b/_examples/file-server/single-page-application/embedded-single-page-application/main.go index a1d8e608..7091dca5 100644 --- a/_examples/file-server/single-page-application/embedded-single-page-application/main.go +++ b/_examples/file-server/single-page-application/embedded-single-page-application/main.go @@ -37,5 +37,5 @@ func main() { // http://localhost:8080/app.js // http://localhost:8080/css/main.css // http://localhost:8080/app2 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/file-server/subdomain/main.go b/_examples/file-server/subdomain/main.go index a064d5e2..94ba8aa5 100644 --- a/_examples/file-server/subdomain/main.go +++ b/_examples/file-server/subdomain/main.go @@ -25,5 +25,5 @@ func newApp() *iris.Application { func main() { app := newApp() - app.Run(iris.Addr(addr)) + app.Listen(addr) } diff --git a/_examples/hello-world/main.go b/_examples/hello-world/main.go index eebc9ff2..3b86e0d7 100644 --- a/_examples/hello-world/main.go +++ b/_examples/hello-world/main.go @@ -38,5 +38,5 @@ func main() { // http://localhost:8080 // http://localhost:8080/ping // http://localhost:8080/hello - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } diff --git a/_examples/hero/basic/main.go b/_examples/hero/basic/main.go index 03707535..88214b14 100644 --- a/_examples/hero/basic/main.go +++ b/_examples/hero/basic/main.go @@ -33,7 +33,7 @@ func main() { // http://localhost:8080/your_name // http://localhost:8080/service/your_name - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func hello(to string) string { diff --git a/_examples/hero/smart-contract/main.go b/_examples/hero/smart-contract/main.go index 1ee5dc50..fd635309 100644 --- a/_examples/hero/smart-contract/main.go +++ b/_examples/hero/smart-contract/main.go @@ -42,7 +42,7 @@ func main() { // http://localhost:8080/users // http://localhost:8080/users/William%20Woe // http://localhost:8080/users/William%20Woe/age - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } /* diff --git a/_examples/http-listening/README.md b/_examples/http-listening/README.md index 9d078d2f..ffedd47f 100644 --- a/_examples/http-listening/README.md +++ b/_examples/http-listening/README.md @@ -11,7 +11,7 @@ we use the `iris.Addr` which is an `iris.Runner` type ```go // Listening on tcp with network address 0.0.0.0:8080 -app.Run(iris.Addr(":8080")) +app.Listen(":8080") ``` Sometimes you have created a standard net/http server somewhere else in your app and want to use that to serve the Iris web app @@ -166,7 +166,7 @@ app.ConfigureHost(func(h *iris.Supervisor) { println("server terminated") }) }) -app.Run(iris.Addr(":8080")) +app.Listen(":8080") ``` Access to all hosts that serve your application can be provided by @@ -201,7 +201,7 @@ app := iris.New() app.Get("/", indexHandler) // run in different goroutine in order to not block the main "goroutine". -go app.Run(iris.Addr(":8080")) +go app.Listen(":8080") // start a second server which is listening on tcp 0.0.0.0:9090, // without "go" keyword because we want to block at the last server-run. app.NewHost(&http.Server{Addr:":9090"}).ListenAndServe() @@ -246,6 +246,6 @@ func main() { ctx.HTML("

hi, I just exist in order to see if the server is closed

") }) - app.Run(iris.Addr(":8080"), iris.WithoutInterruptHandler) + app.Listen(":8080", iris.WithoutInterruptHandler) } ``` diff --git a/_examples/http-listening/custom-httpserver/easy-way/main.go b/_examples/http-listening/custom-httpserver/easy-way/main.go index a4e6dee7..b6f71e8a 100644 --- a/_examples/http-listening/custom-httpserver/easy-way/main.go +++ b/_examples/http-listening/custom-httpserver/easy-way/main.go @@ -22,7 +22,7 @@ func main() { // http://localhost:8080/ // http://localhost:8080/mypath - app.Run(iris.Server(srv)) // same as app.Run(iris.Addr(":8080")) + app.Run(iris.Server(srv)) // same as app.Listen(":8080") // More: // see "multi" if you need to use more than one server at the same app. diff --git a/_examples/http-listening/custom-httpserver/multi/main.go b/_examples/http-listening/custom-httpserver/multi/main.go index 98802b74..083e8e6c 100644 --- a/_examples/http-listening/custom-httpserver/multi/main.go +++ b/_examples/http-listening/custom-httpserver/multi/main.go @@ -43,5 +43,5 @@ func main() { // you can just make a new http.Server instead. // http://localhost:8080/ // http://localhost:8080/mypath - app.Run(iris.Addr(":8080")) // Block here. + app.Listen(":8080") // Block here. } diff --git a/_examples/http-listening/custom-httpserver/std-way/main.go b/_examples/http-listening/custom-httpserver/std-way/main.go index 37f4f67d..b4817d2d 100644 --- a/_examples/http-listening/custom-httpserver/std-way/main.go +++ b/_examples/http-listening/custom-httpserver/std-way/main.go @@ -25,7 +25,7 @@ func main() { // http://localhost:8080/ // http://localhost:8080/mypath println("Start a server listening on http://localhost:8080") - srv.ListenAndServe() // same as app.Run(iris.Addr(":8080")) + srv.ListenAndServe() // same as app.Listen(":8080") // Notes: // Banner is not shown at all. Same for the Interrupt Handler, even if app's configuration allows them. diff --git a/_examples/http-listening/graceful-shutdown/custom-notifier/main.go b/_examples/http-listening/graceful-shutdown/custom-notifier/main.go index 998aaa49..abde2644 100644 --- a/_examples/http-listening/graceful-shutdown/custom-notifier/main.go +++ b/_examples/http-listening/graceful-shutdown/custom-notifier/main.go @@ -42,5 +42,5 @@ func main() { // Start the server and disable the default interrupt handler in order to // handle it clear and simple by our own, without any issues. - app.Run(iris.Addr(":8080"), iris.WithoutInterruptHandler) + app.Listen(":8080", iris.WithoutInterruptHandler) } diff --git a/_examples/http-listening/graceful-shutdown/default-notifier/main.go b/_examples/http-listening/graceful-shutdown/default-notifier/main.go index 58369cbb..c692af57 100644 --- a/_examples/http-listening/graceful-shutdown/default-notifier/main.go +++ b/_examples/http-listening/graceful-shutdown/default-notifier/main.go @@ -30,5 +30,5 @@ func main() { }) // http://localhost:8080 - app.Run(iris.Addr(":8080"), iris.WithoutInterruptHandler) + app.Listen(":8080", iris.WithoutInterruptHandler) } diff --git a/_examples/http-listening/iris-configurator-and-host-configurator/main.go b/_examples/http-listening/iris-configurator-and-host-configurator/main.go index 492bc146..ddece844 100644 --- a/_examples/http-listening/iris-configurator-and-host-configurator/main.go +++ b/_examples/http-listening/iris-configurator-and-host-configurator/main.go @@ -20,7 +20,7 @@ func main() { ctx.HTML("

Hello

\n") }) - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) /* There are more easy ways to notify for global shutdown using the `iris.RegisterOnInterrupt` for default signal interrupt events. You can even go it even further by looking at the: "graceful-shutdown" example. diff --git a/_examples/http-listening/listen-addr-public/main.go b/_examples/http-listening/listen-addr-public/main.go index 7446f46a..f1423570 100644 --- a/_examples/http-listening/listen-addr-public/main.go +++ b/_examples/http-listening/listen-addr-public/main.go @@ -14,10 +14,10 @@ func main() { ctx.Application().ConfigurationReadOnly().GetVHost()) }) - app.Run(iris.Addr(":8080"), iris.WithTunneling) + app.Listen(":8080", iris.WithTunneling) /* The full configuration can be set as: - app.Run(iris.Addr(":8080"), iris.WithConfiguration( + app.Listen(":8080", iris.WithConfiguration( iris.Configuration{ Tunneling: iris.TunnelingConfiguration{ AuthToken: "my-ngrok-auth-client-token", diff --git a/_examples/http-listening/listen-addr/main.go b/_examples/http-listening/listen-addr/main.go index 9c7d3207..551fded8 100644 --- a/_examples/http-listening/listen-addr/main.go +++ b/_examples/http-listening/listen-addr/main.go @@ -12,5 +12,6 @@ func main() { }) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + // Identical to: app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/http-listening/listen-addr/omit-server-errors/main.go b/_examples/http-listening/listen-addr/omit-server-errors/main.go index 3a73b585..339a5b57 100644 --- a/_examples/http-listening/listen-addr/omit-server-errors/main.go +++ b/_examples/http-listening/listen-addr/omit-server-errors/main.go @@ -11,12 +11,12 @@ func main() { ctx.HTML("

Hello World!

") }) - err := app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + err := app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) if err != nil { // do something } // same as: - // err := app.Run(iris.Addr(":8080")) + // err := app.Listen(":8080") // if err != nil && (err != iris.ErrServerClosed || err.Error() != iris.ErrServerClosed.Error()) { // [...] // } diff --git a/_examples/http-listening/listen-addr/omit-server-errors/main_test.go b/_examples/http-listening/listen-addr/omit-server-errors/main_test.go index 9d4a23d8..e26aaf90 100644 --- a/_examples/http-listening/listen-addr/omit-server-errors/main_test.go +++ b/_examples/http-listening/listen-addr/omit-server-errors/main_test.go @@ -34,7 +34,7 @@ func TestListenAddr(t *testing.T) { app.Shutdown(ctx) }() - err := app.Run(iris.Addr(":9829")) + err := app.Listen(":9829") // in this case the error should be logged and return as well. if err != iris.ErrServerClosed { t.Fatalf("expecting err to be `iris.ErrServerClosed` but got: %v", err) @@ -63,7 +63,7 @@ func TestListenAddrWithoutServerErr(t *testing.T) { // we disable the ErrServerClosed, so the error should be nil when server is closed by `app.Shutdown`. // so in this case the iris/http.ErrServerClosed should be NOT logged and NOT return. - err := app.Run(iris.Addr(":9827"), iris.WithoutServerError(iris.ErrServerClosed)) + err := app.Listen(":9827", iris.WithoutServerError(iris.ErrServerClosed)) if err != nil { t.Fatalf("expecting err to be nil but got: %v", err) } diff --git a/_examples/http_request/extract-referer/main.go b/_examples/http_request/extract-referer/main.go index 9b197224..33615d05 100644 --- a/_examples/http_request/extract-referer/main.go +++ b/_examples/http_request/extract-referer/main.go @@ -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)) } diff --git a/_examples/http_request/read-custom-per-type/main.go b/_examples/http_request/read-custom-per-type/main.go index f445cc7d..9a425339 100644 --- a/_examples/http_request/read-custom-per-type/main.go +++ b/_examples/http_request/read-custom-per-type/main.go @@ -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 { diff --git a/_examples/http_request/read-custom-via-unmarshaler/main.go b/_examples/http_request/read-custom-via-unmarshaler/main.go index e83edade..c71f7c69 100644 --- a/_examples/http_request/read-custom-via-unmarshaler/main.go +++ b/_examples/http_request/read-custom-via-unmarshaler/main.go @@ -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 { diff --git a/_examples/http_request/read-form/main.go b/_examples/http_request/read-form/main.go index 7c79b5dc..441bb8ab 100644 --- a/_examples/http_request/read-form/main.go +++ b/_examples/http_request/read-form/main.go @@ -40,5 +40,5 @@ func main() { ctx.Writef("Username: %s", username) }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/http_request/read-json-struct-validation/main.go b/_examples/http_request/read-json-struct-validation/main.go index 3f608007..95ff6f29 100644 --- a/_examples/http_request/read-json-struct-validation/main.go +++ b/_examples/http_request/read-json-struct-validation/main.go @@ -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 diff --git a/_examples/http_request/read-json/main.go b/_examples/http_request/read-json/main.go index 892dac22..1d06d968 100644 --- a/_examples/http_request/read-json/main.go +++ b/_examples/http_request/read-json/main.go @@ -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) } diff --git a/_examples/http_request/read-many/main.go b/_examples/http_request/read-many/main.go index 007902a0..b529fb0f 100644 --- a/_examples/http_request/read-many/main.go +++ b/_examples/http_request/read-many/main.go @@ -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) { diff --git a/_examples/http_request/read-query/main.go b/_examples/http_request/read-query/main.go index f0576038..86386874 100644 --- a/_examples/http_request/read-query/main.go +++ b/_examples/http_request/read-query/main.go @@ -25,5 +25,5 @@ func main() { }) // http://localhost:8080?name=iris&age=3 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/http_request/read-xml/main.go b/_examples/http_request/read-xml/main.go index 9bac9e50..e7234987 100644 --- a/_examples/http_request/read-xml/main.go +++ b/_examples/http_request/read-xml/main.go @@ -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 { diff --git a/_examples/http_request/read-yaml/main.go b/_examples/http_request/read-yaml/main.go index 5d14ac13..27b9e965 100644 --- a/_examples/http_request/read-yaml/main.go +++ b/_examples/http_request/read-yaml/main.go @@ -32,5 +32,5 @@ func handler(ctx iris.Context) { func main() { app := newApp() - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/http_request/request-logger/main.go b/_examples/http_request/request-logger/main.go index 77fa4f3e..73d31503 100644 --- a/_examples/http_request/request-logger/main.go +++ b/_examples/http_request/request-logger/main.go @@ -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)) } diff --git a/_examples/http_request/request-logger/request-logger-file-json/main.go b/_examples/http_request/request-logger/request-logger-file-json/main.go index 6cec4a25..b905a3d1 100644 --- a/_examples/http_request/request-logger/request-logger-file-json/main.go +++ b/_examples/http_request/request-logger/request-logger-file-json/main.go @@ -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{ diff --git a/_examples/http_request/request-logger/request-logger-file/main.go b/_examples/http_request/request-logger/request-logger-file/main.go index a0de8f0a..a6a6ec9b 100644 --- a/_examples/http_request/request-logger/request-logger-file/main.go +++ b/_examples/http_request/request-logger/request-logger-file/main.go @@ -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 diff --git a/_examples/http_request/upload-file/main.go b/_examples/http_request/upload-file/main.go index 9deb55b7..0d34dc16 100644 --- a/_examples/http_request/upload-file/main.go +++ b/_examples/http_request/upload-file/main.go @@ -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)) } diff --git a/_examples/http_request/upload-files/main.go b/_examples/http_request/upload-files/main.go index 9a45164f..e18dff28 100644 --- a/_examples/http_request/upload-files/main.go +++ b/_examples/http_request/upload-files/main.go @@ -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) { diff --git a/_examples/http_responsewriter/content-negotiation/main.go b/_examples/http_responsewriter/content-negotiation/main.go index 640717c3..f4971414 100644 --- a/_examples/http_responsewriter/content-negotiation/main.go +++ b/_examples/http_responsewriter/content-negotiation/main.go @@ -110,5 +110,5 @@ func newApp() *iris.Application { func main() { app := newApp() - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/http_responsewriter/herotemplate/app.go b/_examples/http_responsewriter/herotemplate/app.go index 015472ff..429e4d6a 100644 --- a/_examples/http_responsewriter/herotemplate/app.go +++ b/_examples/http_responsewriter/herotemplate/app.go @@ -50,5 +50,5 @@ func main() { } }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/http_responsewriter/quicktemplate/main.go b/_examples/http_responsewriter/quicktemplate/main.go index a7c993a9..607f35d2 100644 --- a/_examples/http_responsewriter/quicktemplate/main.go +++ b/_examples/http_responsewriter/quicktemplate/main.go @@ -18,5 +18,5 @@ func main() { app := newApp() // http://localhost:8080 // http://localhost:8080/yourname - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } diff --git a/_examples/http_responsewriter/sse-third-party/main.go b/_examples/http_responsewriter/sse-third-party/main.go index dc8bd7af..d0e55941 100644 --- a/_examples/http_responsewriter/sse-third-party/main.go +++ b/_examples/http_responsewriter/sse-third-party/main.go @@ -44,7 +44,7 @@ func main() { }) }() // ... - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } /* For a golang SSE client you can look at: https://github.com/r3labs/sse#example-client */ diff --git a/_examples/http_responsewriter/sse/main.go b/_examples/http_responsewriter/sse/main.go index 042a055c..1abd48c2 100644 --- a/_examples/http_responsewriter/sse/main.go +++ b/_examples/http_responsewriter/sse/main.go @@ -187,5 +187,5 @@ func main() { // http://localhost:8080 // http://localhost:8080/events - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } diff --git a/_examples/http_responsewriter/stream-writer/main.go b/_examples/http_responsewriter/stream-writer/main.go index c7ad0836..c7a6c558 100644 --- a/_examples/http_responsewriter/stream-writer/main.go +++ b/_examples/http_responsewriter/stream-writer/main.go @@ -50,5 +50,5 @@ func main() { } }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/http_responsewriter/transactions/main.go b/_examples/http_responsewriter/transactions/main.go index 63757448..5231b026 100644 --- a/_examples/http_responsewriter/transactions/main.go +++ b/_examples/http_responsewriter/transactions/main.go @@ -50,5 +50,5 @@ func main() { "not been shown. But it has a transient scope(default) so, it is visible as expected!") }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/http_responsewriter/write-gzip/main.go b/_examples/http_responsewriter/write-gzip/main.go index b06e37f9..f1d6369d 100644 --- a/_examples/http_responsewriter/write-gzip/main.go +++ b/_examples/http_responsewriter/write-gzip/main.go @@ -17,5 +17,5 @@ func main() { ctx.GzipResponseWriter().WriteString("Hello World!") }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/http_responsewriter/write-rest/main.go b/_examples/http_responsewriter/write-rest/main.go index 1ccfdff9..622acb82 100644 --- a/_examples/http_responsewriter/write-rest/main.go +++ b/_examples/http_responsewriter/write-rest/main.go @@ -91,5 +91,5 @@ func main() { // // `iris.WithoutServerError` is an optional configurator, // if passed to the `Run` then it will not print its passed error as an actual server error. - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed), iris.WithOptimizations) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed), iris.WithOptimizations) } diff --git a/_examples/i18n/main.go b/_examples/i18n/main.go index d32806a8..fbc1fd8c 100644 --- a/_examples/i18n/main.go +++ b/_examples/i18n/main.go @@ -85,5 +85,5 @@ func main() { // or http://localhost:8080/other?lang=en-US // // or use cookies to set the language. - app.Run(iris.Addr(":8080"), iris.WithSitemap("http://localhost:8080")) + app.Listen(":8080", iris.WithSitemap("http://localhost:8080")) } diff --git a/_examples/miscellaneous/file-logger/main.go b/_examples/miscellaneous/file-logger/main.go index 7890a533..2141b70e 100644 --- a/_examples/miscellaneous/file-logger/main.go +++ b/_examples/miscellaneous/file-logger/main.go @@ -42,7 +42,7 @@ func main() { // Navigate to http://localhost:8080/ping // and open the ./logs{TODAY}.txt file. - if err := app.Run(iris.Addr(":8080"), iris.WithoutBanner, iris.WithoutServerError(iris.ErrServerClosed)); err != nil { + if err := app.Listen(":8080", iris.WithoutBanner, iris.WithoutServerError(iris.ErrServerClosed)); err != nil { app.Logger().Warn("Shutdown with error: " + err.Error()) } } diff --git a/_examples/miscellaneous/pprof/main.go b/_examples/miscellaneous/pprof/main.go index 9ed17ba2..47705503 100644 --- a/_examples/miscellaneous/pprof/main.go +++ b/_examples/miscellaneous/pprof/main.go @@ -17,5 +17,5 @@ func main() { app.Any("/debug/pprof", p) app.Any("/debug/pprof/{action:path}", p) // ___________ - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/miscellaneous/recaptcha/custom_form/main.go b/_examples/miscellaneous/recaptcha/custom_form/main.go index 621fa28e..395c7c45 100644 --- a/_examples/miscellaneous/recaptcha/custom_form/main.go +++ b/_examples/miscellaneous/recaptcha/custom_form/main.go @@ -24,7 +24,7 @@ func main() { // pass the middleware before the main handler or use the `recaptcha.SiteVerify`. app.Post("/comment", r, postComment) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } var htmlForm = `
diff --git a/_examples/miscellaneous/recaptcha/main.go b/_examples/miscellaneous/recaptcha/main.go index b0e952b4..f908b78f 100644 --- a/_examples/miscellaneous/recaptcha/main.go +++ b/_examples/miscellaneous/recaptcha/main.go @@ -36,5 +36,5 @@ func main() { ctx.Writef("succeed.") }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/miscellaneous/recover/main.go b/_examples/miscellaneous/recover/main.go index 5fb7dd66..7825180d 100644 --- a/_examples/miscellaneous/recover/main.go +++ b/_examples/miscellaneous/recover/main.go @@ -21,7 +21,7 @@ func main() { }) // http://localhost:8080, refresh it 5-6 times. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } // Note: diff --git a/_examples/mvc/basic/main.go b/_examples/mvc/basic/main.go index e76b1151..ebdfcde9 100644 --- a/_examples/mvc/basic/main.go +++ b/_examples/mvc/basic/main.go @@ -16,7 +16,7 @@ func main() { app.Logger().SetLevel("debug") mvc.Configure(app.Party("/basic"), basicMVC) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func basicMVC(app *mvc.Application) { diff --git a/_examples/mvc/error-handler/main.go b/_examples/mvc/error-handler/main.go index 15909ce0..f22015d9 100644 --- a/_examples/mvc/error-handler/main.go +++ b/_examples/mvc/error-handler/main.go @@ -23,7 +23,7 @@ func main() { mvcApp.Handle(new(myController)) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } type myController struct { diff --git a/_examples/mvc/hello-world/main.go b/_examples/mvc/hello-world/main.go index e408d473..10a4797c 100644 --- a/_examples/mvc/hello-world/main.go +++ b/_examples/mvc/hello-world/main.go @@ -50,7 +50,7 @@ func main() { // http://localhost:8080/ping // http://localhost:8080/hello // http://localhost:8080/custom_path - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } // ExampleController serves the "/", "/ping" and "/hello". diff --git a/_examples/mvc/middleware/main.go b/_examples/mvc/middleware/main.go index ee6d15d2..af3aacb6 100644 --- a/_examples/mvc/middleware/main.go +++ b/_examples/mvc/middleware/main.go @@ -20,7 +20,7 @@ func main() { // http://localhost:8080/other // // refresh every 10 seconds and you'll see different time output. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func configure(m *mvc.Application) { diff --git a/_examples/mvc/middleware/per-method/main.go b/_examples/mvc/middleware/per-method/main.go index e2eadbc5..f4e13560 100644 --- a/_examples/mvc/middleware/per-method/main.go +++ b/_examples/mvc/middleware/per-method/main.go @@ -84,7 +84,7 @@ func main() { m := mvc.New(app) m.Handle(&exampleController{}) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } type exampleController struct{} diff --git a/_examples/mvc/middleware/without-ctx-next/main.go b/_examples/mvc/middleware/without-ctx-next/main.go index 532f89ab..b29e803c 100644 --- a/_examples/mvc/middleware/without-ctx-next/main.go +++ b/_examples/mvc/middleware/without-ctx-next/main.go @@ -51,7 +51,7 @@ func main() { m.Handle(&exampleController{}) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func doneHandler(ctx iris.Context) { diff --git a/_examples/mvc/regexp/main.go b/_examples/mvc/regexp/main.go index 774cc09a..a68fdf26 100644 --- a/_examples/mvc/regexp/main.go +++ b/_examples/mvc/regexp/main.go @@ -24,7 +24,7 @@ func main() { // http://localhost:8080/module/xxx.json (OK) // http://localhost:8080/module/xxx.xml (Not Found) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } type myController struct{} diff --git a/_examples/mvc/session-controller/main.go b/_examples/mvc/session-controller/main.go index 48611c22..879d9a0a 100644 --- a/_examples/mvc/session-controller/main.go +++ b/_examples/mvc/session-controller/main.go @@ -65,5 +65,5 @@ func main() { // 3. refresh the page some times // 4. close the browser // 5. re-open the browser (if it wasn't in private mode) and re-play 2. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/mvc/singleton/main.go b/_examples/mvc/singleton/main.go index aebfc89e..971d2581 100644 --- a/_examples/mvc/singleton/main.go +++ b/_examples/mvc/singleton/main.go @@ -13,7 +13,7 @@ func main() { mvc.New(app.Party("/")).Handle(&globalVisitorsController{visits: 0}) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } type globalVisitorsController struct { diff --git a/_examples/mvc/websocket/main.go b/_examples/mvc/websocket/main.go index e37b2b2f..12c68f8a 100644 --- a/_examples/mvc/websocket/main.go +++ b/_examples/mvc/websocket/main.go @@ -31,7 +31,7 @@ func main() { websocketAPI.Get("/", websocket.Handler(websocketServer)) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } var visits uint64 diff --git a/_examples/orm/gorm/main.go b/_examples/orm/gorm/main.go index 03d76b9c..5cef4619 100644 --- a/_examples/orm/gorm/main.go +++ b/_examples/orm/gorm/main.go @@ -165,7 +165,7 @@ func main() { "data": user.Serializer(), }) }) - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } type patchParam struct { diff --git a/_examples/orm/xorm/main.go b/_examples/orm/xorm/main.go index 3106d1a1..32b02608 100644 --- a/_examples/orm/xorm/main.go +++ b/_examples/orm/xorm/main.go @@ -70,5 +70,5 @@ func main() { // http://localhost:8080/insert // http://localhost:8080/get - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } diff --git a/_examples/overview/main.go b/_examples/overview/main.go index f5a9c7c5..927911c8 100644 --- a/_examples/overview/main.go +++ b/_examples/overview/main.go @@ -83,7 +83,7 @@ func main() { }) // Listen for incoming HTTP/1.x & HTTP/2 clients on localhost port 8080. - app.Run(iris.Addr(":8080"), iris.WithCharset("UTF-8")) + app.Listen(":8080", iris.WithCharset("UTF-8")) } func logThisMiddleware(ctx iris.Context) { diff --git a/_examples/routing/basic/main.go b/_examples/routing/basic/main.go index 33ace9c1..932aec29 100644 --- a/_examples/routing/basic/main.go +++ b/_examples/routing/basic/main.go @@ -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) { diff --git a/_examples/routing/conditional-chain/main.go b/_examples/routing/conditional-chain/main.go index a7a871f7..4d0747f6 100644 --- a/_examples/routing/conditional-chain/main.go +++ b/_examples/routing/conditional-chain/main.go @@ -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") } diff --git a/_examples/routing/custom-context/method-overriding/main.go b/_examples/routing/custom-context/method-overriding/main.go index 53a9832c..edde8988 100644 --- a/_examples/routing/custom-context/method-overriding/main.go +++ b/_examples/routing/custom-context/method-overriding/main.go @@ -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'" diff --git a/_examples/routing/custom-context/new-implementation/main.go b/_examples/routing/custom-context/new-implementation/main.go index 90e3c0e9..c518cc61 100644 --- a/_examples/routing/custom-context/new-implementation/main.go +++ b/_examples/routing/custom-context/new-implementation/main.go @@ -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") } diff --git a/_examples/routing/custom-high-level-router/main.go b/_examples/routing/custom-high-level-router/main.go index b69f5dc9..66a24b32 100644 --- a/_examples/routing/custom-high-level-router/main.go +++ b/_examples/routing/custom-high-level-router/main.go @@ -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)) } diff --git a/_examples/routing/custom-wrapper/main.go b/_examples/routing/custom-wrapper/main.go index 1dbf3c95..59295f5b 100644 --- a/_examples/routing/custom-wrapper/main.go +++ b/_examples/routing/custom-wrapper/main.go @@ -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: diff --git a/_examples/routing/dynamic-path/main.go b/_examples/routing/dynamic-path/main.go index 420f3f26..f33ece35 100644 --- a/_examples/routing/dynamic-path/main.go +++ b/_examples/routing/dynamic-path/main.go @@ -289,5 +289,5 @@ func main() { // should differ e.g. // /path/{name:string} // /path/{id:uint} - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/routing/dynamic-path/root-wildcard/main.go b/_examples/routing/dynamic-path/root-wildcard/main.go index 67dc7689..06f53927 100644 --- a/_examples/routing/dynamic-path/root-wildcard/main.go +++ b/_examples/routing/dynamic-path/root-wildcard/main.go @@ -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) { diff --git a/_examples/routing/http-errors/main.go b/_examples/routing/http-errors/main.go index 2efe9f0d..e3fdca01 100644 --- a/_examples/routing/http-errors/main.go +++ b/_examples/routing/http-errors/main.go @@ -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 { diff --git a/_examples/routing/macros/main.go b/_examples/routing/macros/main.go index 40087d86..3a41b646 100644 --- a/_examples/routing/macros/main.go +++ b/_examples/routing/macros/main.go @@ -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") } diff --git a/_examples/routing/main.go b/_examples/routing/main.go index 459743c7..60af965a 100644 --- a/_examples/routing/main.go +++ b/_examples/routing/main.go @@ -177,5 +177,5 @@ func main() { // FIRE NOT FOUND http://localhost:8080/coudlntfound */ - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/routing/not-found-suggests/main.go b/_examples/routing/not-found-suggests/main.go index e57002c9..b2bfb5a8 100644 --- a/_examples/routing/not-found-suggests/main.go +++ b/_examples/routing/not-found-suggests/main.go @@ -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) { diff --git a/_examples/routing/overview/main.go b/_examples/routing/overview/main.go index 62657aaa..1ba7fe6c 100644 --- a/_examples/routing/overview/main.go +++ b/_examples/routing/overview/main.go @@ -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) { diff --git a/_examples/routing/reverse/main.go b/_examples/routing/reverse/main.go index 80122d7b..e6ae7413 100644 --- a/_examples/routing/reverse/main.go +++ b/_examples/routing/reverse/main.go @@ -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") } diff --git a/_examples/routing/route-state/main.go b/_examples/routing/route-state/main.go index 30b35cf3..6c362c11 100644 --- a/_examples/routing/route-state/main.go +++ b/_examples/routing/route-state/main.go @@ -41,5 +41,5 @@ func main() { ctx.Exec("GET", "/invisible/iris") }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/routing/writing-a-middleware/globally/main.go b/_examples/routing/writing-a-middleware/globally/main.go index 891c4d9d..3bb50926 100644 --- a/_examples/routing/writing-a-middleware/globally/main.go +++ b/_examples/routing/writing-a-middleware/globally/main.go @@ -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) { diff --git a/_examples/routing/writing-a-middleware/per-route/main.go b/_examples/routing/writing-a-middleware/per-route/main.go index f95c9ccf..223a019f 100644 --- a/_examples/routing/writing-a-middleware/per-route/main.go +++ b/_examples/routing/writing-a-middleware/per-route/main.go @@ -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) { diff --git a/_examples/sessions/database/badger/main.go b/_examples/sessions/database/badger/main.go index bb8a7c08..fe084941 100644 --- a/_examples/sessions/database/badger/main.go +++ b/_examples/sessions/database/badger/main.go @@ -104,5 +104,5 @@ func main() { } }) - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } diff --git a/_examples/sessions/database/boltdb/main.go b/_examples/sessions/database/boltdb/main.go index d94b5a9d..6bfbc27b 100644 --- a/_examples/sessions/database/boltdb/main.go +++ b/_examples/sessions/database/boltdb/main.go @@ -105,5 +105,5 @@ func main() { } }) - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } diff --git a/_examples/sessions/database/redis/main.go b/_examples/sessions/database/redis/main.go index 87185a17..8cc67fca 100644 --- a/_examples/sessions/database/redis/main.go +++ b/_examples/sessions/database/redis/main.go @@ -141,5 +141,5 @@ func main() { } }) - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } diff --git a/_examples/sessions/flash-messages/main.go b/_examples/sessions/flash-messages/main.go index 45c14492..dfe6f8f4 100644 --- a/_examples/sessions/flash-messages/main.go +++ b/_examples/sessions/flash-messages/main.go @@ -38,5 +38,5 @@ func main() { ctx.Writef(", and again from the same context: %s", name) }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/sessions/middleware/main.go b/_examples/sessions/middleware/main.go index 5e20011f..a0c0d734 100644 --- a/_examples/sessions/middleware/main.go +++ b/_examples/sessions/middleware/main.go @@ -143,5 +143,5 @@ func main() { // the name should remains "Edward" }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/sessions/overview/main.go b/_examples/sessions/overview/main.go index 006dce03..97b1a379 100644 --- a/_examples/sessions/overview/main.go +++ b/_examples/sessions/overview/main.go @@ -46,5 +46,5 @@ func main() { app.Get("/login", login) app.Get("/logout", logout) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/sessions/securecookie/main.go b/_examples/sessions/securecookie/main.go index 006c0ac3..e66effcc 100644 --- a/_examples/sessions/securecookie/main.go +++ b/_examples/sessions/securecookie/main.go @@ -81,5 +81,5 @@ func newApp() *iris.Application { func main() { app := newApp() - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/sitemap/main.go b/_examples/sitemap/main.go index fc1d3261..31b2a9f7 100644 --- a/_examples/sitemap/main.go +++ b/_examples/sitemap/main.go @@ -15,7 +15,7 @@ func main() { // Lists only online GET static routes. // // Reference: https://www.sitemaps.org/protocol.html - app.Run(iris.Addr(":8080"), iris.WithSitemap(startURL)) + app.Listen(":8080", iris.WithSitemap(startURL)) } func newApp() *iris.Application { diff --git a/_examples/structuring/login-mvc-single-responsibility-package/main.go b/_examples/structuring/login-mvc-single-responsibility-package/main.go index 692cfede..067ac312 100644 --- a/_examples/structuring/login-mvc-single-responsibility-package/main.go +++ b/_examples/structuring/login-mvc-single-responsibility-package/main.go @@ -27,7 +27,7 @@ func main() { // http://localhost:8080/user/me // http://localhost:8080/user/logout // http://localhost:8080/user/1 - app.Run(iris.Addr(":8080"), configure) + app.Listen(":8080", configure) } func configureMVC(app *mvc.Application) { diff --git a/_examples/subdomains/multi/main.go b/_examples/subdomains/multi/main.go index bc1199b6..d0907246 100644 --- a/_examples/subdomains/multi/main.go +++ b/_examples/subdomains/multi/main.go @@ -36,5 +36,5 @@ func main() { // Make sure you prepend the "http" in your browser // because .local is a virtual domain we think to show case you // that you can declare any syntactical correct name as a subdomain in iris. - app.Run(iris.Addr("domain.local:80")) // for beginners: look ../hosts file + app.Listen("domain.local:80") // for beginners: look ../hosts file } diff --git a/_examples/subdomains/redirect/main.go b/_examples/subdomains/redirect/main.go index e078366e..51562a99 100644 --- a/_examples/subdomains/redirect/main.go +++ b/_examples/subdomains/redirect/main.go @@ -22,7 +22,7 @@ func main() { // http://mydomain.com -> http://www.mydomain.com // http://mydomain.com/users -> http://www.mydomain.com/users // http://mydomain.com/users/login -> http://www.mydomain.com/users/login - app.Run(iris.Addr(addr)) + app.Listen(addr) } func newApp() *iris.Application { diff --git a/_examples/subdomains/single/main.go b/_examples/subdomains/single/main.go index 73358971..2ecb7f43 100644 --- a/_examples/subdomains/single/main.go +++ b/_examples/subdomains/single/main.go @@ -42,5 +42,5 @@ func main() { // http://admin.mydomain.com/hey2 // http://mydomain.com // http://mydomain.com/hey - app.Run(iris.Addr("mydomain.com:80")) // for beginners: look ../hosts file + app.Listen("mydomain.com:80") // for beginners: look ../hosts file } diff --git a/_examples/subdomains/wildcard/main.go b/_examples/subdomains/wildcard/main.go index a8ee618e..5c9edcfe 100644 --- a/_examples/subdomains/wildcard/main.go +++ b/_examples/subdomains/wildcard/main.go @@ -54,7 +54,7 @@ func main() { // http://username1.mydomain.com:8080 // http://username2.mydomain.com:8080/something // http://username3.mydomain.com:8080/something/yourname - app.Run(iris.Addr("mydomain.com:8080")) // for beginners: look ../hosts file + app.Listen("mydomain.com:8080") // for beginners: look ../hosts file } func dynamicSubdomainHandler(ctx iris.Context) { diff --git a/_examples/subdomains/www/main.go b/_examples/subdomains/www/main.go index 254a4e93..280179a6 100644 --- a/_examples/subdomains/www/main.go +++ b/_examples/subdomains/www/main.go @@ -64,7 +64,7 @@ func main() { // http://www.mydomain.com/contact // http://www.mydomain.com/api/users // http://www.mydomain.com/api/users/42 - if err := app.Run(iris.Addr("mydomain.com:80")); err != nil { + if err := app.Listen("mydomain.com:80"); err != nil { panic(err) } } diff --git a/_examples/testing/httptest/main.go b/_examples/testing/httptest/main.go index c70f0ff6..c86fc7fc 100644 --- a/_examples/testing/httptest/main.go +++ b/_examples/testing/httptest/main.go @@ -42,5 +42,5 @@ func h(ctx iris.Context) { func main() { app := newApp() - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/tutorial/api-for-apache-kafka/src/main.go b/_examples/tutorial/api-for-apache-kafka/src/main.go index e371700c..bc8f609e 100644 --- a/_examples/tutorial/api-for-apache-kafka/src/main.go +++ b/_examples/tutorial/api-for-apache-kafka/src/main.go @@ -77,7 +77,7 @@ func main() { // POST, GET: http://localhost:8080/api/v1/topics // POST : http://localhost:8080/apiv1/topics/{topic}/produce?key=my-key // GET : http://localhost:8080/apiv1/topics/{topic}/consume?partition=0&offset=0 (these url query parameters are optional) - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } // simple use-case, you can use templates and views obviously, see the "_examples/views" examples. diff --git a/_examples/tutorial/caddy/server1/main.go b/_examples/tutorial/caddy/server1/main.go index 62900b43..0f7f87ec 100644 --- a/_examples/tutorial/caddy/server1/main.go +++ b/_examples/tutorial/caddy/server1/main.go @@ -14,7 +14,7 @@ func main() { mvc.New(app).Handle(new(Controller)) // http://localhost:9091 - app.Run(iris.Addr(":9091")) + app.Listen(":9091") } // Layout contains all the binding properties for the shared/layout.html diff --git a/_examples/tutorial/caddy/server2/main.go b/_examples/tutorial/caddy/server2/main.go index f338859f..282aa1c3 100644 --- a/_examples/tutorial/caddy/server2/main.go +++ b/_examples/tutorial/caddy/server2/main.go @@ -21,7 +21,7 @@ func main() { // PUT http://localhost:9092/user/42 // DELETE http://localhost:9092/user/42 // GET http://localhost:9092/user/followers/42 - app.Run(iris.Addr(":9092")) + app.Listen(":9092") } // UserController is our user example controller. diff --git a/_examples/tutorial/dropzonejs/README.md b/_examples/tutorial/dropzonejs/README.md index c7db448f..ea449d73 100644 --- a/_examples/tutorial/dropzonejs/README.md +++ b/_examples/tutorial/dropzonejs/README.md @@ -139,7 +139,7 @@ func main() { }) // Start the server at http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` diff --git a/_examples/tutorial/dropzonejs/README_PART2.md b/_examples/tutorial/dropzonejs/README_PART2.md index 65e57392..29233fc9 100644 --- a/_examples/tutorial/dropzonejs/README_PART2.md +++ b/_examples/tutorial/dropzonejs/README_PART2.md @@ -212,7 +212,7 @@ func main() { }) // start the server at http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` diff --git a/_examples/tutorial/dropzonejs/src/main.go b/_examples/tutorial/dropzonejs/src/main.go index ad8b8825..2fb04087 100644 --- a/_examples/tutorial/dropzonejs/src/main.go +++ b/_examples/tutorial/dropzonejs/src/main.go @@ -164,5 +164,5 @@ func main() { }) // start the server at http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/tutorial/mongodb/main.go b/_examples/tutorial/mongodb/main.go index 01e0065b..ca8ebdb9 100644 --- a/_examples/tutorial/mongodb/main.go +++ b/_examples/tutorial/mongodb/main.go @@ -79,5 +79,5 @@ func main() { // GET: http://localhost:8080/api/store/movies/{id} // PUT: http://localhost:8080/api/store/movies/{id} // DELETE: http://localhost:8080/api/store/movies/{id} - app.Run(iris.Addr(fmt.Sprintf(":%s", env.Port)), iris.WithOptimizations) + app.Listen(fmt.Sprintf(":%s", env.Port), iris.WithOptimizations) } diff --git a/_examples/tutorial/online-visitors/main.go b/_examples/tutorial/online-visitors/main.go index 8119e4f2..5da58936 100644 --- a/_examples/tutorial/online-visitors/main.go +++ b/_examples/tutorial/online-visitors/main.go @@ -47,7 +47,7 @@ func main() { // Each page has its own online-visitors counter. app.Get("/", h) app.Get("/other", h2) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } type page struct { diff --git a/_examples/tutorial/url-shortener/main.go b/_examples/tutorial/url-shortener/main.go index 2fe519c8..ad1c2e6b 100644 --- a/_examples/tutorial/url-shortener/main.go +++ b/_examples/tutorial/url-shortener/main.go @@ -24,7 +24,7 @@ func main() { // release the "db" connection when server goes off. iris.RegisterOnInterrupt(db.Close) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func newApp(db *DB) *iris.Application { diff --git a/_examples/tutorial/vuejs-todo-mvc/README.md b/_examples/tutorial/vuejs-todo-mvc/README.md index a768df37..63a67671 100644 --- a/_examples/tutorial/vuejs-todo-mvc/README.md +++ b/_examples/tutorial/vuejs-todo-mvc/README.md @@ -548,7 +548,7 @@ func main() { todosApp.Handle(new(controllers.TodoController)) // start the web server at http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` diff --git a/_examples/tutorial/vuejs-todo-mvc/src/web/main.go b/_examples/tutorial/vuejs-todo-mvc/src/web/main.go index 7507e860..75f0800d 100644 --- a/_examples/tutorial/vuejs-todo-mvc/src/web/main.go +++ b/_examples/tutorial/vuejs-todo-mvc/src/web/main.go @@ -60,5 +60,5 @@ func main() { todosWebsocketApp.Router.Get("/", websocket.Handler(websocketServer, idGenerator)) // start the web server at http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/versioning/main.go b/_examples/versioning/main.go index c046b882..a3aa21c1 100644 --- a/_examples/versioning/main.go +++ b/_examples/versioning/main.go @@ -12,7 +12,7 @@ func main() { examplePerParty(app) // Read the README.md before any action. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } // How to test: diff --git a/_examples/view/context-view-data/main.go b/_examples/view/context-view-data/main.go index 80ab3a07..01e3ed88 100644 --- a/_examples/view/context-view-data/main.go +++ b/_examples/view/context-view-data/main.go @@ -47,7 +47,7 @@ func main() { // http://localhost:8080 // http://localhost:8080/about - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } // Notes: ViewData("", myCustomStruct{}) will set this myCustomStruct value as a root binding data, diff --git a/_examples/view/embedding-templates-into-app/main.go b/_examples/view/embedding-templates-into-app/main.go index fb80ca00..9743dfb6 100644 --- a/_examples/view/embedding-templates-into-app/main.go +++ b/_examples/view/embedding-templates-into-app/main.go @@ -53,7 +53,7 @@ func main() { // http://localhost:8080/nolayout // http://localhost:8080/my // http://localhost:8080/my/other - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } // Note for new Gophers: diff --git a/_examples/view/overview/main.go b/_examples/view/overview/main.go index 2ef4f4ae..bfe47c00 100644 --- a/_examples/view/overview/main.go +++ b/_examples/view/overview/main.go @@ -20,7 +20,7 @@ func main() { }) // http://localhost:8080/ - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } /* diff --git a/_examples/view/template_django_0/main.go b/_examples/view/template_django_0/main.go index 6f2133b5..72dc256d 100644 --- a/_examples/view/template_django_0/main.go +++ b/_examples/view/template_django_0/main.go @@ -26,7 +26,7 @@ func main() { app.Get("/", hi) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func hi(ctx iris.Context) { diff --git a/_examples/view/template_html_0/main.go b/_examples/view/template_html_0/main.go index 887be6b7..c7aa1730 100644 --- a/_examples/view/template_html_0/main.go +++ b/_examples/view/template_html_0/main.go @@ -24,7 +24,7 @@ func main() { app.Get("/", hi) // http://localhost:8080 - app.Run(iris.Addr(":8080"), iris.WithCharset("UTF-8")) // defaults to that but you can change it. + app.Listen(":8080", iris.WithCharset("UTF-8")) // defaults to that but you can change it. } func hi(ctx iris.Context) { diff --git a/_examples/view/template_html_1/main.go b/_examples/view/template_html_1/main.go index bbca2cfc..95ffc6fa 100644 --- a/_examples/view/template_html_1/main.go +++ b/_examples/view/template_html_1/main.go @@ -25,5 +25,5 @@ func main() { }) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/view/template_html_2/main.go b/_examples/view/template_html_2/main.go index 0bf81cf5..270b99ba 100644 --- a/_examples/view/template_html_2/main.go +++ b/_examples/view/template_html_2/main.go @@ -46,5 +46,5 @@ func main() { // http://localhost:8080/nolayout // http://localhost:8080/my // http://localhost:8080/my/other - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/view/template_html_3/main.go b/_examples/view/template_html_3/main.go index 22ee6864..c9fcb381 100644 --- a/_examples/view/template_html_3/main.go +++ b/_examples/view/template_html_3/main.go @@ -58,7 +58,7 @@ func main() { // http://localhost:8080 // http://localhost:8080/redirect/my-page1 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func writePathHandler(ctx iris.Context) { diff --git a/_examples/view/template_html_4/main.go b/_examples/view/template_html_4/main.go index 5d8a24be..ef0b97b8 100644 --- a/_examples/view/template_html_4/main.go +++ b/_examples/view/template_html_4/main.go @@ -63,7 +63,7 @@ func main() { app.Get("/mypath7/{paramfirst}/{paramsecond}/static/{paramthird}", emptyHandler).Name = "my-page7" // http://127.0.0.1:8080 - app.Run(iris.Addr(host)) + app.Listen(host) } func emptyHandler(ctx iris.Context) { diff --git a/_examples/view/template_html_5/main.go b/_examples/view/template_html_5/main.go index df1bf342..7e79e0b2 100644 --- a/_examples/view/template_html_5/main.go +++ b/_examples/view/template_html_5/main.go @@ -27,5 +27,5 @@ func main() { }) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/view/template_jet_0/main.go b/_examples/view/template_jet_0/main.go index bd8762a8..93608402 100644 --- a/_examples/view/template_jet_0/main.go +++ b/_examples/view/template_jet_0/main.go @@ -141,5 +141,5 @@ func main() { port = ":" + port } - app.Run(iris.Addr(port)) + app.Listen(port) } diff --git a/_examples/view/template_jet_1_embedded/main.go b/_examples/view/template_jet_1_embedded/main.go index 2d9e4d6f..e8495725 100644 --- a/_examples/view/template_jet_1_embedded/main.go +++ b/_examples/view/template_jet_1_embedded/main.go @@ -30,5 +30,5 @@ func main() { port = ":" + port } - app.Run(iris.Addr(port)) + app.Listen(port) } diff --git a/_examples/view/template_jet_2/main.go b/_examples/view/template_jet_2/main.go index 3e9f8e44..db872d2b 100644 --- a/_examples/view/template_jet_2/main.go +++ b/_examples/view/template_jet_2/main.go @@ -58,7 +58,7 @@ func main() { // http://localhost:8080 // http://localhost:8080/redirect/my-page1 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func writePathHandler(ctx iris.Context) { diff --git a/_examples/view/template_jet_3/main.go b/_examples/view/template_jet_3/main.go index 6c67b4cc..6928243e 100644 --- a/_examples/view/template_jet_3/main.go +++ b/_examples/view/template_jet_3/main.go @@ -30,7 +30,7 @@ func main() { ctx.View("index.jet") }) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } type ViewBuiler struct { diff --git a/_examples/view/template_pug_0/main.go b/_examples/view/template_pug_0/main.go index ea8f414f..a7d38186 100644 --- a/_examples/view/template_pug_0/main.go +++ b/_examples/view/template_pug_0/main.go @@ -16,7 +16,7 @@ func main() { app.Get("/", index) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func index(ctx iris.Context) { diff --git a/_examples/view/template_pug_1/main.go b/_examples/view/template_pug_1/main.go index 3d376a49..27c50f06 100644 --- a/_examples/view/template_pug_1/main.go +++ b/_examples/view/template_pug_1/main.go @@ -24,7 +24,7 @@ func main() { app.Get("/", index) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func index(ctx iris.Context) { diff --git a/_examples/view/template_pug_2/main.go b/_examples/view/template_pug_2/main.go index 2c1b7efc..28186b14 100644 --- a/_examples/view/template_pug_2/main.go +++ b/_examples/view/template_pug_2/main.go @@ -20,7 +20,7 @@ func main() { app.Get("/", index) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func index(ctx iris.Context) { diff --git a/_examples/view/template_pug_3/main.go b/_examples/view/template_pug_3/main.go index ac7b0b55..97b6d87e 100644 --- a/_examples/view/template_pug_3/main.go +++ b/_examples/view/template_pug_3/main.go @@ -15,7 +15,7 @@ func main() { app.Get("/", index) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func index(ctx iris.Context) { diff --git a/_examples/view/write-to/main.go b/_examples/view/write-to/main.go index ac6ee9bd..438c101f 100644 --- a/_examples/view/write-to/main.go +++ b/_examples/view/write-to/main.go @@ -38,5 +38,5 @@ func main() { app.Logger().Errorf("error from app.View: %v", err) } - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/webassembly/basic/main.go b/_examples/webassembly/basic/main.go index e89d9d1d..7faae0b3 100644 --- a/_examples/webassembly/basic/main.go +++ b/_examples/webassembly/basic/main.go @@ -23,5 +23,5 @@ func main() { // visit http://localhost:8080 // you should get an html output like this: // Hello, the current time is: 2018-07-09 05:54:12.564 +0000 UTC m=+0.003900161 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/websocket/basic/server.go b/_examples/websocket/basic/server.go index 8a6b1299..8bf95d8a 100644 --- a/_examples/websocket/basic/server.go +++ b/_examples/websocket/basic/server.go @@ -116,5 +116,5 @@ func main() { // serves the npm browser websocket client usage example. app.HandleDir("/browserify", "./browserify") - app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) + app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) } diff --git a/_examples/websocket/native-messages/main.go b/_examples/websocket/native-messages/main.go index 4f3b5353..8da79291 100644 --- a/_examples/websocket/native-messages/main.go +++ b/_examples/websocket/native-messages/main.go @@ -55,5 +55,5 @@ func main() { // Target some browser windows/tabs to http://localhost:8080 and send some messages, // see the static/js/chat.js, // note that the client is using only the browser's native WebSocket API instead of the neffos one. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } diff --git a/_examples/websocket/socketio/main.go b/_examples/websocket/socketio/main.go index 7670ac5c..3e218052 100644 --- a/_examples/websocket/socketio/main.go +++ b/_examples/websocket/socketio/main.go @@ -47,7 +47,7 @@ func main() { app.HandleMany("GET POST", "/socket.io/{any:path}", iris.FromStd(server)) app.HandleDir("/", "./asset") - app.Run(iris.Addr(":8000"), + app.Listen(":8000", iris.WithoutPathCorrection, iris.WithoutServerError(iris.ErrServerClosed), ) diff --git a/cache/cache.go b/cache/cache.go index 9b451763..7298d21a 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -17,7 +17,7 @@ Example code: app := iris.Default() middleware := cache.Handler(2 *time.Minute) app.Get("/hello", middleware, h) - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func h(ctx iris.Context) { diff --git a/configuration.go b/configuration.go index af003e01..33a305f6 100644 --- a/configuration.go +++ b/configuration.go @@ -191,7 +191,7 @@ var WithGlobalConfiguration = func(app *Application) { // from the main application's `Run` function. // // Usage: -// err := app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) +// err := app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) // will return `nil` if the server's error was `http/iris#ErrServerClosed`. // // See `Configuration#IgnoreServerErrors []string` too. @@ -1001,7 +1001,7 @@ func (c Configuration) GetOther() map[string]interface{} { // WithConfiguration sets the "c" values to the framework's configurations. // // Usage: -// app.Run(iris.Addr(":8080"), iris.WithConfiguration(iris.Configuration{/* fields here */ })) +// app.Listen(":8080", iris.WithConfiguration(iris.Configuration{/* fields here */ })) // or // iris.WithConfiguration(iris.YAML("./cfg/iris.yml")) // or diff --git a/hero/binding_test.go b/hero/binding_test.go index da4c11aa..475e1d0a 100644 --- a/hero/binding_test.go +++ b/hero/binding_test.go @@ -218,7 +218,7 @@ func TestGetBindingsForFunc(t *testing.T) { // test explicitly of http.Header and its underline type map[string][]string which // but shouldn't be binded to request headers because of the (.Explicitly()), instead // the map should be binded to our last of "deps" which is is a dynamic functions reads from request body's JSON - // (it's a builtin dependency as well but we delcared it to test user dynamic dependencies too). + // (it's a builtin dependency as well but we declared it to test user dynamic dependencies too). { // 13 Func: func(http.Header) testResponse { return testResponse{"builtin http.Header dep"} diff --git a/hero/container.go b/hero/container.go index 609ecd9e..607fb8a3 100644 --- a/hero/container.go +++ b/hero/container.go @@ -180,31 +180,6 @@ func (c *Container) Struct(ptrValue interface{}, partyParamsCount int) *Struct { return makeStruct(ptrValue, c, partyParamsCount) } -/* -func (c *Container) Inject(ctx context.Context, toPtr ...interface{}) error { - types := make([]reflect.Type, 0, len(toPtr)) - for _, ptr := range toPtr { - types = append(types, indirectType(typeOf(ptr))) - } - - bindings := getBindingsFor(types, c.Dependencies, -1) - - for _, b := range bindings { - v, err := b.Dependency.Handle(ctx, b.Input) - if err != nil { - if err == ErrSeeOther { - continue - } - - return err - } - - reflect.ValueOf(toPtr).Set(v) - } - - return nil -}*/ - // ErrMissingDependency may returned only from the `Container.Inject` method // when not a matching dependency found for "toPtr". var ErrMissingDependency = errors.New("missing dependency") diff --git a/typescript/_examples/editor/main.go b/typescript/_examples/editor/main.go index e8f3768f..03a7d723 100644 --- a/typescript/_examples/editor/main.go +++ b/typescript/_examples/editor/main.go @@ -28,6 +28,6 @@ func main() { // http://localhost:8080 // http://localhost:4444 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") e.Stop() } diff --git a/typescript/_examples/typescript/main.go b/typescript/_examples/typescript/main.go index b6125b0c..4070ea37 100644 --- a/typescript/_examples/typescript/main.go +++ b/typescript/_examples/typescript/main.go @@ -25,7 +25,7 @@ func main() { ts.Run(app.Logger().Infof) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } // open http://localhost:8080 diff --git a/typescript/editor/editor.go b/typescript/editor/editor.go index 8f5ad72e..aaca608b 100644 --- a/typescript/editor/editor.go +++ b/typescript/editor/editor.go @@ -13,7 +13,7 @@ Usage: e.Run(app.Logger().Infof) [...] - app.Run(iris.Addr(":8080")) + app.Listen(":8080") e.Stop() diff --git a/view/README.md b/view/README.md index 4f53ac3d..7f9e6a9d 100644 --- a/view/README.md +++ b/view/README.md @@ -64,7 +64,7 @@ func main() { }) // Start the server using a network address. - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } ``` @@ -110,7 +110,7 @@ func main() { app.Get("/", hi) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } func hi(ctx iris.Context) { @@ -148,7 +148,7 @@ func main() { app.Get("/", hi) // http://localhost:8080 - app.Run(iris.Addr(":8080")) + app.Listen(":8080") } type page struct {