Skip to content

Instantly share code, notes, and snippets.

@gertjana
Created August 8, 2021 15:51
Show Gist options
  • Save gertjana/621274a4cd292d8e9b0f4c707aef0aed to your computer and use it in GitHub Desktop.
Save gertjana/621274a4cd292d8e9b0f4c707aef0aed to your computer and use it in GitHub Desktop.
small go webservice
package main
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
e := echo.New()
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.GET("/", hello)
e.Logger.Fatal(e.Start(":8000"))
}
func hello(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment