Feat(ktm-booking): Initial commit
Some checks failed
ktm-booking-bot/ktm-booking-bot/pipeline/head Something is wrong with the build of this commit
Some checks failed
ktm-booking-bot/ktm-booking-bot/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
31
backend/cmd/server/health.go
Normal file
31
backend/cmd/server/health.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/render"
|
||||
)
|
||||
|
||||
type HealthStatus struct {
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
func (*HealthStatus) Render(w http.ResponseWriter, r *http.Request) error {
|
||||
// Pre-processing before a response is marshalled and sent across the wire
|
||||
return nil
|
||||
}
|
||||
|
||||
// Health Check``
|
||||
// @Summary Responds to health check
|
||||
// @Description Description
|
||||
// @Tags Base
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} string
|
||||
// @Failure 404 {object} string
|
||||
// @Router /health [get]
|
||||
func healthHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var okRender HealthStatus
|
||||
okRender.Status = "ok"
|
||||
render.Render(w, r, &okRender)
|
||||
}
|
||||
Reference in New Issue
Block a user