summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2023-09-04 14:24:58 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2023-09-04 14:24:58 +0530
commit6c4524551336753d6c2c3cd124061020a5f814bc (patch)
tree0845841f600870cfd441988872f713f14c0678c4 /main.go
Initial trial - Hello World Message
Diffstat (limited to 'main.go')
-rw-r--r--main.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..6b1e80f
--- /dev/null
+++ b/main.go
@@ -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",
+ })
+}