mirror of
https://github.com/pushbits/server.git
synced 2025-08-02 16:18:47 +02:00
Restructure project layout
This commit is contained in:
parent
a49db216d5
commit
9a4a096526
32 changed files with 35 additions and 35 deletions
22
internal/api/health.go
Normal file
22
internal/api/health.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// HealthHandler holds information for processing requests about the server's health.
|
||||
type HealthHandler struct {
|
||||
DB Database
|
||||
}
|
||||
|
||||
// Health returns the health status of the server.
|
||||
func (h *HealthHandler) Health(ctx *gin.Context) {
|
||||
if err := h.DB.Health(); err != nil {
|
||||
ctx.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, gin.H{})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue