27 lines
487 B
Go
27 lines
487 B
Go
package server
|
|
|
|
import (
|
|
"allapp-go-v2/internal/bootstrap"
|
|
"fmt"
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
"github.com/gofiber/fiber/v3/middleware/requestid"
|
|
)
|
|
|
|
func Start(appCtx *bootstrap.App) error {
|
|
// 1️⃣ 创建 fiber 实例
|
|
app := fiber.New()
|
|
|
|
app.Use(requestid.New())
|
|
|
|
// 2️⃣ 注册路由
|
|
//registerRoutes(app, appCtx)
|
|
|
|
// 3️⃣ 启动服务
|
|
addr := fmt.Sprintf(":%s", appCtx.Config.Server.Port)
|
|
|
|
fmt.Println("🚀 server running at", addr)
|
|
|
|
return app.Listen(addr)
|
|
}
|