好像有戏

This commit is contained in:
des
2026-01-22 00:12:24 +08:00
parent 27c89d66f7
commit d09d9d9f1a
4 changed files with 54 additions and 42 deletions

View File

@@ -0,0 +1,35 @@
package route
import (
"Crimson-Gatekeeper/internal/query"
"net/http"
"github.com/gin-gonic/gin"
)
type Controller interface {
register(gin *gin.Engine)
}
func RegCtrl(cs []Controller) {
route := gin.Default()
for _, ctrl := range cs {
ctrl.register(route)
}
http.Handle("/", route)
}
type TestBoot struct {
c *query.Query
}
func (t *TestBoot) Run() error {
http.HandleFunc("/echo", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("hello world!"))
})
return nil
}
func NewTestBoot(q *query.Query) *TestBoot {
return &TestBoot{q}
}