From 27c89d66f76cc9107295f5566caac7da1d53a0d1 Mon Sep 17 00:00:00 2001 From: des <18638715007@163.com> Date: Wed, 21 Jan 2026 19:40:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=AA=E5=A5=BD=E4=BA=86=EF=BC=8C=E6=88=91?= =?UTF-8?q?=E9=80=90=E6=BC=B8=E9=96=8B=E5=A7=8B=E7=90=86=E8=A7=A3=E4=B8=80?= =?UTF-8?q?=E5=88=87=EF=BC=88=E4=B8=A6=E4=B8=8D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- srv/cmd/gatekeeper/main.go | 9 +++++++-- srv/internal/application/application.go | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/srv/cmd/gatekeeper/main.go b/srv/cmd/gatekeeper/main.go index 175670a..ac56f15 100644 --- a/srv/cmd/gatekeeper/main.go +++ b/srv/cmd/gatekeeper/main.go @@ -1,11 +1,16 @@ package main import ( - "Crimson-Gatekeeper/internal/application" + "net/http" "github.com/go-spring/spring-core/gs" ) +type Test struct{} + func main() { - gs.Provide(application.New).AsServer() + http.HandleFunc("/echo", func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("hello world!")) + }) + gs.Run() } diff --git a/srv/internal/application/application.go b/srv/internal/application/application.go index 7b0e8e0..0365add 100644 --- a/srv/internal/application/application.go +++ b/srv/internal/application/application.go @@ -1,14 +1,26 @@ package application import ( + "context" + "github.com/gin-gonic/gin" + "github.com/go-spring/spring-core/gs" ) type Controller interface { RegisterRoute() } -func New() *gin.Engine { - app := gin.Default() - return app +type AppPak struct { + core *gin.Engine +} + +func (s *AppPak) ListenAndServe(sig gs.ReadySignal) error { + s.core = gin.Default() + s.core.Run("7777") + return nil +} + +func (_ *AppPak) Shutdown(ctx context.Context) error { + return nil }