Created
July 16, 2024 16:45
-
-
Save BK1031/3ee51664f79b21e06fec83818856da26 to your computer and use it in GitHub Desktop.
singlestore-go-bookstore start server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package api | |
import ( | |
"bookstore/config" | |
"net/http" | |
"github.com/gin-gonic/gin" | |
) | |
func StartServer() { | |
r := gin.Default() | |
RegisterRoutes(r) | |
r.Run(":" + config.Port) | |
} | |
func RegisterRoutes(r *gin.Engine) { | |
r.GET("/ping", func(c *gin.Context) { | |
c.JSON(http.StatusOK, gin.H{ | |
"message": "pong", | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment