第一版完成
This commit is contained in:
32
main.go
Normal file
32
main.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
"cms-api/internal/controller"
|
||||
"cms-api/internal/middleware"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// 创建HTTP服务器
|
||||
s := g.Server()
|
||||
|
||||
// 设置端口
|
||||
s.SetPort(10861)
|
||||
|
||||
// 注册中间件
|
||||
s.Use(middleware.CORS)
|
||||
s.Use(middleware.ResponseHandler)
|
||||
|
||||
// 注册路由
|
||||
controller.RegisterRoutes(s)
|
||||
|
||||
// 启动服务器
|
||||
fmt.Println("CMS API服务器启动中...")
|
||||
fmt.Printf("服务器地址: http://localhost:10861\n")
|
||||
fmt.Printf("API文档: http://localhost:10861/swagger\n")
|
||||
|
||||
s.Run()
|
||||
}
|
||||
Reference in New Issue
Block a user