Files
ktm-booking-bot/backend/internal/ktmtrainbot/getcurrenttime.go
Samuel Pua 7cf10b07d4
Some checks failed
ktm-booking-bot/ktm-booking-bot/pipeline/head Something is wrong with the build of this commit
Feat(ktm-booking): Initial commit
2022-09-27 02:50:07 +08:00

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)
}