Skip to content

Instantly share code, notes, and snippets.

@BK1031
Created July 16, 2024 16:45
Show Gist options
  • Save BK1031/3ee51664f79b21e06fec83818856da26 to your computer and use it in GitHub Desktop.
Save BK1031/3ee51664f79b21e06fec83818856da26 to your computer and use it in GitHub Desktop.
singlestore-go-bookstore start server
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