From c50c45d74b1008e7332889cf57548c063dd4a6c4 Mon Sep 17 00:00:00 2001 From: wangguixi Date: Sat, 8 Nov 2025 12:03:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=BF=9C=E7=A8=8B=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Knowledge_Test_Go/hack/config.yaml | 31 +++++++++++++++++++------------ Knowledge_Test_Go/internal/cmd/cmd.go | 8 +++++++- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Knowledge_Test_Go/hack/config.yaml b/Knowledge_Test_Go/hack/config.yaml index 83c7dc6..df94e53 100644 --- a/Knowledge_Test_Go/hack/config.yaml +++ b/Knowledge_Test_Go/hack/config.yaml @@ -1,13 +1,20 @@ +# https://goframe.org/docs/web/server-config-file-template +server: + address: ":8000" + openapiPath: "/api.json" + swaggerPath: "/swagger" + +# https://goframe.org/docs/core/glog-config +logger: + level : "all" + stdout: true + +# https://goframe.org/docs/core/gdb-config-file + + +database: + default: + debug: true + link: "mysql:root:123456@tcp(127.0.0.1:3306)/练习1?loc=Local&parseTime=true" + -# CLI tool, only in development environment. -# https://goframe.org/docs/cli -gfcli: - gen: - dao: - - link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test" - descriptionTag: true - - docker: - build: "-a amd64 -s linux -p temp -ew" - tagPrefixes: - - my.image.pub/my-app \ No newline at end of file diff --git a/Knowledge_Test_Go/internal/cmd/cmd.go b/Knowledge_Test_Go/internal/cmd/cmd.go index 68a3c54..4bc2366 100644 --- a/Knowledge_Test_Go/internal/cmd/cmd.go +++ b/Knowledge_Test_Go/internal/cmd/cmd.go @@ -17,7 +17,13 @@ var ( Brief: "start http server", Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { s := g.Server() - s.Group("/", func(group *ghttp.RouterGroup) { + s.Group("/api", func(group *ghttp.RouterGroup) { + group.Middleware(ghttp.MiddlewareHandlerResponse) + group.Bind( + hello.NewV1(), + ) + }) + s.Group("/admin", func(group *ghttp.RouterGroup) { group.Middleware(ghttp.MiddlewareHandlerResponse) group.Bind( hello.NewV1(),