1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 13:05:56 +00:00

Nothing serious yet, thinking new features with the team, post some to help us!

Former-commit-id: 5741c47230bd2f3b88bf9e943742418be664cfdd
This commit is contained in:
kataras
2017-07-30 19:47:50 +03:00
parent eb087e5ba6
commit 4f2985cb4e
5 changed files with 54 additions and 27 deletions

View File

@@ -5,10 +5,18 @@ package main
import (
"github.com/kataras/iris"
"github.com/kataras/iris/context"
"github.com/kataras/iris/middleware/logger"
"github.com/kataras/iris/middleware/recover"
)
func main() {
app := iris.Default()
app := iris.New()
// Optionally, add two built'n handlers
// that can recover from any http-relative panics
// and log the requests to the terminal.
app.Use(recover.New())
app.Use(logger.New())
// Method: GET
// Resource: http://localhost:8080/
@@ -32,5 +40,5 @@ func main() {
// http://localhost:8080
// http://localhost:8080/ping
// http://localhost:8080/hello
app.Run(iris.Addr(":8080"))
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
}

View File

@@ -6,7 +6,16 @@ import (
"github.com/kataras/iris"
)
// Same as `main.go` for go1.8+ but it omits the
// `github.com/kataras/iris/context` import path
// because of the type alias feature of go 1.9.
func main() {
// The `iris#Default` adds two built'n handlers
// that can recover from any http-relative panics
// and log the requests to the terminal.
//
// Use `iris#New` instead.
app := iris.Default()
// Method: GET