This commit is contained in:
yumaojun03 2025-05-07 11:06:40 +08:00
parent 54c624bde6
commit 43db1bdd7f
4 changed files with 11 additions and 4 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
test.env

View File

@ -13,7 +13,7 @@ import (
)
// 构造函数, 用户初始化这个结构体
func NewBookHandler() *BookApiHandler {
func NewBookApiHandler() *BookApiHandler {
return &BookApiHandler{
db: config.Get().MySQL.DB(),
svc: controller.NewBookController(),

View File

@ -6,7 +6,11 @@ import (
"os"
"github.com/gin-gonic/gin"
"gitlab.com/go-course-project/go17/book/api"
book "gitlab.com/go-course-project/go17/book/api"
// user "gitlab.com/go-course-project/go17/user/api"
// comment "gitlab.com/go-course-project/go17/comment/api"
// token "gitlab.com/go-course-project/go17/token/api"
"gitlab.com/go-course-project/go17/book/config"
)
@ -27,7 +31,10 @@ func main() {
// gin Engine, 它包装了http server
server := gin.Default()
api.NewBookHandler().Registry(server)
book.NewBookApiHandler().Registry(server)
// user.NewUserApiHandler().Registry(server)
// comment.NewCommentApiHandler().Registry(server)
// token.NewTokenApiHandler().Registry(server)
if err := server.Run(conf.App.Address()); err != nil {
log.Println(err)