micrach/gateway/controllers.go
Yanislav Igonin c8c9850625
Refactoring - Fiber (#14)
* add fiber

* disable gin, enable fiber

* gradually enabling app setup

* change env

* add routes

* add static

* connect template engine

* add simple load test

* make it executable

* add rate limiter

* doc

* connect get threads controller

* clean

* add compression middleware

* add etag middleware

* lint

* add recover middleware

* check isFromLocal method

* connect get thread by id controller

* connect create thread controller

* connect captcha controller

* connect update thread controller

* rename file

* playing with css

* connect gateway controller
2022-04-09 15:16:09 +03:00

18 lines
346 B
Go

package gateway
import (
"micrach/config"
"github.com/gofiber/fiber/v2"
)
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"})
}
return c.JSON(fiber.Map{
"message": "pong",
})
}