gohttpserver/internal/handlers/handlenow.go

16 lines
271 B
Go
Raw Normal View History

2022-11-28 03:59:20 +00:00
package handlers
2020-10-05 13:15:32 +00:00
import (
"net/http"
"time"
)
2022-11-28 03:59:20 +00:00
func (s *Handlers) HandleNow() http.HandlerFunc {
2020-10-05 13:15:32 +00:00
type response struct {
Now time.Time `json:"now"`
}
return func(w http.ResponseWriter, r *http.Request) {
s.respondJSON(w, r, &response{Now: time.Now()}, 200)
}
}