Feat(ktm-booking): Initial commit
Some checks failed
ktm-booking-bot/ktm-booking-bot/pipeline/head Something is wrong with the build of this commit
Some checks failed
ktm-booking-bot/ktm-booking-bot/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
25
backend/internal/ktmtrainbot/getcurrenttime.go
Normal file
25
backend/internal/ktmtrainbot/getcurrenttime.go
Normal file
@@ -0,0 +1,25 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user