53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
|
/*
|
||
|
ScheduleTogether Backend
|
||
|
Copyright (C) 2024, Zervó Zadachin
|
||
|
|
||
|
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||
|
|
||
|
This program is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU Affero General Public License version 3
|
||
|
as published by the Free Software Foundation.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU Affero General Public License version 3 for more details.
|
||
|
|
||
|
This program incorporates external libraries for certain functionalities.
|
||
|
These libraries are covered by their respective licenses, and their usage
|
||
|
agreements are as outlined in their respective documentation or source
|
||
|
code.
|
||
|
|
||
|
You should have received a copy of the GNU Affero General Public License
|
||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
package handlers
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"github.com/kataras/iris/v12"
|
||
|
|
||
|
"git.zervo.org/scheduletogether/scheduletogetherbackend/pkg/types"
|
||
|
)
|
||
|
|
||
|
// PingHandler_RegisterRoutes registers routes for the PingHandler
|
||
|
func PingHandler_RegisterRoutes(party iris.Party) {
|
||
|
party.Get("/", Ping_Handler)
|
||
|
}
|
||
|
|
||
|
// PingHandler handles the GET /ping endpoint and returns a "pong" response
|
||
|
func Ping_Handler(ctx iris.Context) {
|
||
|
|
||
|
now := time.Now().Format("2006-01-02 15:04:05")
|
||
|
|
||
|
response := types.PingResponse{
|
||
|
Message: "pong",
|
||
|
Time: now,
|
||
|
Ok: true,
|
||
|
}
|
||
|
|
||
|
ctx.JSON(response)
|
||
|
}
|