Files
acc-server-manager/local/utl/server/server.go
Fran Jurmanović 1bb73c866a init
2024-07-09 23:42:26 +02:00

26 lines
429 B
Go

package server
import (
"acc-server-manager/local/utl/common"
"fmt"
"os"
"github.com/gofiber/fiber/v2"
)
func Start(r *fiber.App) *fiber.App {
r.Get("/ping", func(c *fiber.Ctx) error {
return c.SendString("pong")
})
port := os.Getenv("PORT")
if port == "" {
port = "4000"
}
err := r.Listen(":" + port)
if err != nil {
msg := fmt.Sprintf("Running on %s:%s", common.GetIP(), port)
println(msg)
}
return r
}