You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
941 B
Go

package main
import (
"fmt"
"os"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/compress"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/favicon"
"github.com/gofiber/fiber/v2/middleware/logger"
)
// The main function initializes a Fiber web server, sets up middleware, initializes the router, and
// listens for incoming requests on port 4321.
func main() {
fmt.Printf("stem v1.0.3\n")
// инициализация fiber
app := fiber.New()
app.Use(logger.New())
app.Use(cors.New())
app.Use(favicon.New())
app.Use(compress.New())
initRouter(app)
err := app.Listen(":4321")
checkError("run fiber", err)
}
// ============================ разные утилиты ==========================
// Проверяет наличие ошибки
func checkError(src string, err error) {
if err != nil {
fmt.Printf("(%s): %s\n", src, err)
os.Exit(1)
}
}