mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-10-22 16:31:24 +00:00
add api response helper
This commit is contained in:
1 file changed
+12
@@ -0,0 +1,12 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func respond(w http.ResponseWriter, status int, data any) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(status)
|
||||
json.NewEncoder(w).Encode(data)
|
||||
}
|
||||
Reference in new issue
Block a user