Blog/blog.go

29 lines
699 B
Go
Raw Permalink Normal View History

2024-03-21 07:25:12 +00:00
package main
import (
2024-05-07 13:33:51 +00:00
"blog/api"
2024-03-21 07:25:12 +00:00
"blog/config"
"blog/models"
"blog/routes"
"fmt"
"net/http"
"strconv"
)
func init() {
models.CompiledContent() //克隆或者更新文章、递归生成文章、导航、短链 Map、加载模板
}
func main() {
routes.InitRoute()
2024-05-07 13:33:51 +00:00
api.InitApi()
2024-03-21 07:25:12 +00:00
fmt.Printf("Versionv%v \n", config.Cfg.Version)
fmt.Printf("ListenAndServe On Port %v \n", config.Cfg.Port)
fmt.Printf("Dashboard On Path %v \n", config.Cfg.Dashboard)
fmt.Printf("UpdateArticle's GitHookUrl: %v Secret: %v \n", config.Cfg.GitHookUrl, config.Cfg.WebHookSecret)
if err := http.ListenAndServe(":"+strconv.Itoa(config.Cfg.Port), nil); err != nil {
fmt.Println("ServeErr:", err)
}
}