23 lines
462 B
Go
23 lines
462 B
Go
package routers
|
|
|
|
import (
|
|
"encoding/json"
|
|
endpoints "monitoring/app/storage/clickhouse/tables"
|
|
"net/http"
|
|
)
|
|
|
|
func AddEndpointMetric (r *http.Request) (interface{}, int) {
|
|
d := json.NewDecoder(r.Body)
|
|
body := endpoints.EndpointMetric{}
|
|
err := d.Decode(&body)
|
|
if err != nil {
|
|
return nil, http.StatusBadRequest
|
|
}
|
|
|
|
err = endpoints.AddEndpointMetric(body)
|
|
if err != nil {
|
|
return nil, http.StatusInternalServerError
|
|
}
|
|
|
|
return nil, http.StatusAccepted
|
|
} |