micrach/gateway/controllers.go

18 lines
346 B
Go
Raw Normal View History

package gateway
import (
2022-04-09 15:15:41 +03:00
"micrach/config"
2022-04-09 15:15:41 +03:00
"github.com/gofiber/fiber/v2"
)
2022-04-09 15:15:41 +03:00
func Ping(c *fiber.Ctx) error {
headerKey := c.GetReqHeaders()["Authorization"]
if config.App.Gateway.ApiKey != headerKey {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{"error": "Unauthorized"})
}
2022-04-09 15:15:41 +03:00
return c.JSON(fiber.Map{
"message": "pong",
})
}