summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-19 07:49:16 -0500
committerJeff Carr <[email protected]>2025-03-19 07:49:16 -0500
commit3869dc8c2406fe8e3cc7a851e0ff232f1b4add3b (patch)
tree7514acd264eeca413f17bd5837c41a77a0a9b75f
parent9e7887ae88b1d60902b6348d8ee0876ab679f915 (diff)
build against ginpbv0.0.9v0.0.8v0.0.7
-rw-r--r--gin.go31
1 files changed, 25 insertions, 6 deletions
diff --git a/gin.go b/gin.go
index a95877b..fbf1e7d 100644
--- a/gin.go
+++ b/gin.go
@@ -20,6 +20,30 @@ func handlePort(port int) {
r := ginpb.Default()
// Ping test
+ r.GET("/ping", func(c *ginpb.Context) {
+ // c.String(http.StatusOK, "pong")
+ })
+
+ // Get user value
+ r.GET("/user/:name", func(c *ginpb.Context) {
+ // c.JSON(http.StatusOK, gin.H{"user": "test", "status": "no value"})
+ /*
+ user := c.Params.ByName("name")
+ value, ok := db[user]
+ if ok {
+ c.JSON(http.StatusOK, ginpb.H{"user": user, "value": value})
+ } else {
+ c.JSON(http.StatusOK, ginpb.H{"user": user, "status": "no value"})
+ }
+ */
+ })
+
+}
+
+func handlePortGin(port int) {
+ r := gin.Default()
+
+ // Ping test
r.GET("/ping", func(c *gin.Context) {
c.String(http.StatusOK, "pong")
})
@@ -27,12 +51,7 @@ func handlePort(port int) {
// Get user value
r.GET("/user/:name", func(c *gin.Context) {
user := c.Params.ByName("name")
- value, ok := db[user]
- if ok {
- c.JSON(http.StatusOK, gin.H{"user": user, "value": value})
- } else {
- c.JSON(http.StatusOK, gin.H{"user": user, "status": "no value"})
- }
+ c.JSON(http.StatusOK, gin.H{"user": user, "status": "no value"})
})
}