1
0
mirror of https://github.com/labstack/echo.git synced 2025-05-31 23:19:42 +02:00
echo/examples/hello/server.go
Vishal Rana 73fa05f826 Added panic recover middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-17 22:54:29 -07:00

35 lines
450 B
Go

package main
import (
"net/http"
"github.com/labstack/echo"
mw "github.com/labstack/echo/middleware"
)
// Handler
func hello(c *echo.Context) *echo.HTTPError {
return c.String(http.StatusOK, "Hello, World!\n")
}
func main() {
// Echo instance
e := echo.New()
//------------
// Middleware
//------------
// Recover
e.Use(mw.Recover())
// Logger
e.Use(mw.Logger())
// Routes
e.Get("/", hello)
// Start server
e.Run(":1323")
}