package main import ( "github.com/bytedance/sonic" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/compress" ) func main() { app := fiber.New(fiber.Config{ AppName: "君鸿卡管系统 v0.0.1", StrictRouting: true, CaseSensitive: true, JSONEncoder: sonic.Marshal, JSONDecoder: sonic.Unmarshal, // Prefork: true, // 该字段是用来开启监听端口是否可以被多个应用监听的,非必要不要开了 }) //压缩中间件-根据Accept-Encoding使用gzip 、 deflate 和 brotli 压缩来压缩响应 app.Use(compress.New(compress.Config{ // Next: func(c *fiber.Ctx) bool { return c.Path() == "/test"}, //返回值为true时会跳过压缩中间件 Level: 0, })) app.Listen(":3000") }