summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2023-09-04 16:19:32 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2023-09-04 16:19:32 +0530
commit117d461c4944f189576f0c4967851de458ba6f32 (patch)
tree7248b4bde0cf03e06920bf3622228652cc71b5ba /main.go
parent1f61825e4b0b46d65b0a379c6b87e50d1467cfdc (diff)
Updating README + Creating idgen package and importing it
Diffstat (limited to 'main.go')
-rw-r--r--main.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/main.go b/main.go
index 34df0fa..fb9628e 100644
--- a/main.go
+++ b/main.go
@@ -4,6 +4,9 @@ import (
"net/http"
"github.com/labstack/echo/v4"
+
+ "fmt"
+ "github.com/justsaumit/fis-golang/idgen"
)
type HelloWorld struct {
@@ -15,6 +18,7 @@ func main() {
e.GET("/hello", Greetings)
e.GET("/hello/:name", GreetingsWithParams)
e.GET("/hello-queries", GreetingsWithQuery)
+ e.GET("/genid", GenerateIDHandler)
e.Logger.Fatal(e.Start(":3000"))
}
@@ -37,3 +41,14 @@ func GreetingsWithQuery(c echo.Context) error {
Message: "Hello World, I'm using queries and my name is " + query,
})
}
+
+
+func GenerateIDHandler(c echo.Context) error {
+ id := idgen.GenerateID()
+ //Print the generated ID to the console.
+ fmt.Println("Generated ID:", id)
+ return c.JSON(http.StatusOK, map[string]string{"message": "Generated ID: " + id})
+ // return c.JSON(http.StatusOK, HelloWorld{
+ // Message: "Generated ID: " + id,
+ //})
+}