mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 10:27:06 +00:00
don't fire ErrServerClosed on manually interrupt signals (CTRL/CMD+C)
Former-commit-id: 673c84dd13bb99c0926aa1b4a6b4eff9745403d8
This commit is contained in:
@@ -35,7 +35,7 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := client.Post("https://localhost/hello", "application/json", buf)
|
||||
resp, err := client.Post("https://localhost/helloworld.Greeter/SayHello", "application/json", buf)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ func main() {
|
||||
app.Logger().SetLevel("debug")
|
||||
|
||||
// The Iris server should ran under TLS (it's a gRPC requirement).
|
||||
// POST: https://localhost:443/helloworld.greeter/sayhello
|
||||
// POST: https://localhost:443/helloworld.Greeter/SayHello
|
||||
// with request data: {"name": "John"}
|
||||
// and expected output: {"message": "Hello John"}
|
||||
app.Run(iris.TLS(":443", "server.crt", "server.key"))
|
||||
@@ -32,7 +32,6 @@ func main() {
|
||||
func newApp() *iris.Application {
|
||||
app := iris.New()
|
||||
// app.Configure(iris.WithLowercaseRouting) // OPTIONAL.
|
||||
app.Logger().SetLevel("debug")
|
||||
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.HTML("<h1>Index Page</h1>")
|
||||
@@ -55,7 +54,9 @@ func newApp() *iris.Application {
|
||||
return app
|
||||
}
|
||||
|
||||
type myController struct{}
|
||||
type myController struct {
|
||||
// Ctx iris.Context
|
||||
}
|
||||
|
||||
// SayHello implements helloworld.GreeterServer.
|
||||
func (c *myController) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
|
||||
|
||||
@@ -76,12 +76,8 @@ func main() {
|
||||
// http://localhost:8080/user/me
|
||||
// http://localhost:8080/user/logout
|
||||
// basic auth: "admin", "password", see "./middleware/basicauth.go" source file.
|
||||
app.Run(
|
||||
// Starts the web server at localhost:8080
|
||||
iris.Addr("localhost:8080"),
|
||||
// Ignores err server closed log when CTRL/CMD+C pressed.
|
||||
iris.WithoutServerError(iris.ErrServerClosed),
|
||||
// Enables faster json serialization and more.
|
||||
iris.WithOptimizations,
|
||||
)
|
||||
|
||||
// Starts the web server at localhost:8080
|
||||
// Enables faster json serialization and more.
|
||||
app.Listen(":8080", iris.WithOptimizations)
|
||||
}
|
||||
|
||||
@@ -30,14 +30,7 @@ func main() {
|
||||
// http://localhost:8080/hello/iris
|
||||
// http://localhost:8080/movies
|
||||
// http://localhost:8080/movies/1
|
||||
app.Run(
|
||||
// Start the web server at localhost:8080
|
||||
iris.Addr("localhost:8080"),
|
||||
// skip err server closed when CTRL/CMD+C pressed:
|
||||
iris.WithoutServerError(iris.ErrServerClosed),
|
||||
// enables faster json serialization and more:
|
||||
iris.WithOptimizations,
|
||||
)
|
||||
app.Listen(":8080", iris.WithOptimizations)
|
||||
}
|
||||
|
||||
// note the mvc.Application, it's not iris.Application.
|
||||
|
||||
Reference in New Issue
Block a user