Improve comments and code readability

This commit is contained in:
Marco Realacci 2023-01-10 01:21:53 +01:00
parent f6ad6db2f7
commit 3de158e5a5
19 changed files with 84 additions and 43 deletions

View file

@ -1,16 +1,18 @@
package api
import (
"github.com/julienschmidt/httprouter"
"net/http"
"github.com/julienschmidt/httprouter"
"github.com/notherealmarco/WASAPhoto/service/api/helpers"
)
// liveness is an HTTP handler that checks the API server status. If the server cannot serve requests (e.g., some
// resources are not ready), this should reply with HTTP Status 500. Otherwise, with HTTP Status 200
func (rt *_router) liveness(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
/* Example of liveness check:
if err := rt.DB.Ping(); err != nil {
if err := rt.db.Ping(); err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}*/
}
helpers.SendStatus(200, w, "Server is live!", rt.baseLogger)
}