add go fiber example

This commit is contained in:
Mauricio Siu
2024-06-30 20:14:30 -06:00
parent c251b5957b
commit e613f0cae5
10 changed files with 183 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package main
import (
"net/http"
)
func (app *application) healthcheckHandler(w http.ResponseWriter, r *http.Request) {
data := map[string]string{
"status": "ok",
"version": version,
}
// No need to add acess control origin headers. On other routes, that may be necessary
err := app.writeJSON(w, http.StatusOK, data, nil)
if err != nil {
app.logger.Error(err.Error())
http.Error(w, "server error", http.StatusInternalServerError)
}
}