Labstack/echo
Jump to navigation
Jump to search
External
Internal
Overview
Install Dependencies
From the root directory of your module, execute:
go get github.com/labstack/echo/v4@v4.11.4
Server
package main
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func hello(c echo.Context) error {
return c.String(http.StatusOK, "hello!")
}
func main() {
s := echo.New()
// Middleware
s.Use(middleware.Logger())
s.Use(middleware.Recover())
// Routes
s.GET("/", hello)
// Start server
s.Logger.Fatal(s.Start(":30000"))
}