Initial commit
This commit is contained in:
28
internal/server/routes.go
Normal file
28
internal/server/routes.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func (s *Server) RegisterRoutes() http.Handler {
|
||||
r := gin.Default()
|
||||
|
||||
r.GET("/", s.HelloWorldHandler)
|
||||
|
||||
r.GET("/health", s.healthHandler)
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func (s *Server) HelloWorldHandler(c *gin.Context) {
|
||||
resp := make(map[string]string)
|
||||
resp["message"] = "Hello World"
|
||||
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func (s *Server) healthHandler(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, s.db.Health())
|
||||
}
|
||||
Reference in New Issue
Block a user