mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 10:27:06 +00:00
reorganization of _examples and add some new examples such as iris+groupcache+mysql+docker
Former-commit-id: ed635ee95de7160cde11eaabc0c1dcb0e460a620
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
||||
app.ConfigureHost(func(host *iris.Supervisor) { // <- HERE: IMPORTANT
|
||||
// You can control the flow or defer something using some of the host's methods:
|
||||
// host.RegisterOnError
|
||||
// host.RegisterOnServe
|
||||
host.RegisterOnShutdown(func() {
|
||||
app.Logger().Infof("Application shutdown on signal")
|
||||
})
|
||||
})
|
||||
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.HTML("<h1>Hello</h1>\n")
|
||||
})
|
||||
|
||||
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.
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user