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:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -139,7 +139,7 @@ func main() {
|
||||
})
|
||||
|
||||
// Start the server at http://localhost:8080
|
||||
app.Run(iris.Addr(":8080"))
|
||||
app.Listen(":8080")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ func main() {
|
||||
})
|
||||
|
||||
// start the server at http://localhost:8080
|
||||
app.Run(iris.Addr(":8080"))
|
||||
app.Listen(":8080")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -164,5 +164,5 @@ func main() {
|
||||
})
|
||||
|
||||
// start the server at http://localhost:8080
|
||||
app.Run(iris.Addr(":8080"))
|
||||
app.Listen(":8080")
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user