diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ +package main + +import ( + "net/http" + "github.com/labstack/echo/v4" +) + +type HelloWorld struct { + Message string `json:"message"` +} + +func main() { + e := echo.New() + e.GET("/hello", Greetings) + e.Logger.Fatal(e.Start(":3000")) +} + +func Greetings(c echo.Context) error { + return c.JSON(http.StatusOK, HelloWorld{ + Message: "Hello World", + }) +} |