添加文件: xy_sh/cmd/server/main.go
This commit is contained in:
parent
30b98f3771
commit
0a06bdbdf8
|
|
@ -0,0 +1,30 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"xy_sh/internal/config"
|
||||||
|
"xy_sh/internal/router"
|
||||||
|
"xy_sh/pkg/crypto"
|
||||||
|
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
cfg := config.LoadConfig()
|
||||||
|
|
||||||
|
crypto.InitCrypto(cfg.SM3Salt, cfg.SM4Key)
|
||||||
|
|
||||||
|
app := fiber.New(fiber.Config{
|
||||||
|
AppName: "XY SH API Server",
|
||||||
|
ReadTimeout: cfg.ReadTimeout,
|
||||||
|
WriteTimeout: cfg.WriteTimeout,
|
||||||
|
})
|
||||||
|
|
||||||
|
router.SetupRoutes(app)
|
||||||
|
|
||||||
|
log.Printf("服务启动,监听端口: %s", cfg.ServerPort)
|
||||||
|
if err := app.Listen(":" + cfg.ServerPort); err != nil {
|
||||||
|
log.Fatalf("服务启动失败: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue