mirror of
https://git.fightbot.fun/hxuanyu/BingPaper.git
synced 2026-02-15 10:19:32 +08:00
基本功能实现
This commit is contained in:
36
main.go
Normal file
36
main.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"BingDailyImage/internal/bootstrap"
|
||||
"BingDailyImage/internal/config"
|
||||
"BingDailyImage/internal/util"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// @title BingDailyImage API
|
||||
// @version 1.0
|
||||
// @description 必应每日一图抓取、存储、管理与公共 API 服务。
|
||||
// @host localhost:8080
|
||||
// @BasePath /api/v1
|
||||
|
||||
// @securityDefinitions.apikey BearerAuth
|
||||
// @in header
|
||||
// @name Authorization
|
||||
|
||||
func main() {
|
||||
// 1. 初始化
|
||||
r := bootstrap.Init()
|
||||
|
||||
// 2. 输出欢迎信息
|
||||
bootstrap.LogWelcomeInfo()
|
||||
|
||||
// 3. 启动服务
|
||||
cfg := config.GetConfig()
|
||||
util.Logger.Info("Server starting", zap.Int("port", cfg.Server.Port))
|
||||
if err := r.Run(fmt.Sprintf(":%d", cfg.Server.Port)); err != nil {
|
||||
util.Logger.Fatal("Server failed to start", zap.Error(err))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user