From a97d89e3e523d233ea4bbf5944e60e72b4497d59 Mon Sep 17 00:00:00 2001 From: Damanpreet Singh Date: Tue, 2 Dec 2025 16:26:33 +0000 Subject: [PATCH 1/2] Add route /ping --- main.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.go b/main.go index f142b22..987b83e 100644 --- a/main.go +++ b/main.go @@ -111,6 +111,19 @@ func setupRouter() *gin.Engine { c.String(http.StatusOK, requestID.String()) }) + r.GET("/ping", func(c *gin.Context) { + logRequest(c) + codeParams, ok := c.Request.URL.Query()["code"] + if ok && len(codeParams) > 0 { + statusCode, _ := strconv.Atoi(codeParams[0]) + if statusCode >= 200 && statusCode < 600 { + c.Status(statusCode) + } + } + requestID := uuid.New() + c.String(http.StatusOK, requestID.String()) + }) + return r } From e8c7b1a29f7eec37b2c366e51541d11b9b213fdd Mon Sep 17 00:00:00 2001 From: Damanpreet Singh Date: Tue, 2 Dec 2025 16:36:55 +0000 Subject: [PATCH 2/2] Added route /hello --- main.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index 987b83e..5f5a9a3 100644 --- a/main.go +++ b/main.go @@ -111,17 +111,9 @@ func setupRouter() *gin.Engine { c.String(http.StatusOK, requestID.String()) }) - r.GET("/ping", func(c *gin.Context) { + r.GET("/hello", func(c *gin.Context) { logRequest(c) - codeParams, ok := c.Request.URL.Query()["code"] - if ok && len(codeParams) > 0 { - statusCode, _ := strconv.Atoi(codeParams[0]) - if statusCode >= 200 && statusCode < 600 { - c.Status(statusCode) - } - } - requestID := uuid.New() - c.String(http.StatusOK, requestID.String()) + c.String(http.StatusOK, "world") }) return r