1
0
mirror of https://github.com/labstack/echo.git synced 2026-05-22 10:15:26 +02:00
Files
echo/examples/hello/server.go
T

29 lines
383 B
Go
Raw Normal View History

2015-04-18 16:47:48 -07:00
package main
import (
"net/http"
"github.com/labstack/echo"
2015-04-20 23:24:34 -07:00
mw "github.com/labstack/echo/middleware"
2015-04-18 16:47:48 -07:00
)
// Handler
2015-05-20 15:59:36 -07:00
func hello(c *echo.Context) error {
2015-05-05 21:55:49 -07:00
return c.String(http.StatusOK, "Hello, World!\n")
2015-04-18 16:47:48 -07:00
}
func main() {
2015-04-25 12:46:27 -07:00
// Echo instance
2015-04-18 16:47:48 -07:00
e := echo.New()
// Middleware
2015-05-15 12:29:14 -07:00
e.Use(mw.Logger())
2015-05-18 11:33:11 -07:00
e.Use(mw.Recover())
2015-04-18 16:47:48 -07:00
// Routes
e.Get("/", hello)
// Start server
2015-05-10 08:22:49 -07:00
e.Run(":1323")
2015-04-18 16:47:48 -07:00
}