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.
39 lines
793 B
Go
39 lines
793 B
Go
12 months ago
|
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"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
fmt.Printf("stem v1.0.2\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)
|
||
|
}
|
||
|
}
|