mirror of
https://gitlab.com/foxixus/neomovies-api.git
synced 2025-10-28 01:48:51 +05:00
24 lines
537 B
Go
24 lines
537 B
Go
|
|
package handlers
|
||
|
|
|
||
|
|
import (
|
||
|
|
"encoding/json"
|
||
|
|
"net/http"
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/gorilla/mux"
|
||
|
|
)
|
||
|
|
|
||
|
|
func muxVars(r *http.Request) map[string]string { return mux.Vars(r) }
|
||
|
|
|
||
|
|
func writeJSON(w http.ResponseWriter, status int, v interface{}) {
|
||
|
|
w.Header().Set("Content-Type", "application/json")
|
||
|
|
w.WriteHeader(status)
|
||
|
|
_ = json.NewEncoder(w).Encode(v)
|
||
|
|
}
|
||
|
|
|
||
|
|
type metaEnvelope struct {
|
||
|
|
FetchedAt time.Time `json:"fetchedAt"`
|
||
|
|
APIVersion string `json:"apiVersion"`
|
||
|
|
ResponseTime int64 `json:"responseTime"`
|
||
|
|
}
|