20 lines
453 B
Go
20 lines
453 B
Go
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)
|
|
}
|
|
}
|