Some checks failed
ktm-booking-bot/ktm-booking-bot/pipeline/head Something is wrong with the build of this commit
26 lines
565 B
Go
26 lines
565 B
Go
package ktmtrainbot
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/go-chi/render"
|
|
)
|
|
|
|
// Get Current Server Time
|
|
// @Summary Get current server time
|
|
// @Description Description
|
|
// @Tags Info
|
|
// @Produce json
|
|
// @Success 200 {object} ServerTimeResponse
|
|
// @Failure 400 {object} common.ErrResponse
|
|
// @Router /api/v1/ktmtrainbot/current-time [get]
|
|
func (env *Env) getCurrentTime(w http.ResponseWriter, r *http.Request) {
|
|
timeNow := time.Now()
|
|
|
|
var res ServerTimeResponse
|
|
res.ServerLocalTime = timeNow.In(time.Local).Format(time.RFC1123Z)
|
|
|
|
render.Render(w, r, &res)
|
|
}
|