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.
seaweed/main.go

40 lines
813 B
Go

package main
import (
"fmt"
"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"
"os"
)
func main() {
fmt.Printf("sea v1.0.0\\n")
db := openDB()
// инициализация fiber
app := fiber.New()
app.Use(logger.New())
app.Use(cors.New())
app.Use(favicon.New())
app.Use(compress.New())
initRouter(app, db)
err := app.Listen(":9899")
checkError("run fiber", err)
}
// ============================ разные утилиты ==========================
// Проверяет наличие ошибки
func checkError(src string, err error) {
if err != nil {
fmt.Printf("(%s): %s\n", src, err)
os.Exit(1)
}
}