init repo

This commit is contained in:
VaalaCat
2024-08-28 00:02:28 +08:00
committed by vaalacat
commit 13148b95e3
97 changed files with 10214 additions and 0 deletions

28
services/api/handler.go Normal file
View File

@@ -0,0 +1,28 @@
package api
import (
"github.com/gin-gonic/gin"
)
type APIHandler struct {
router *gin.Engine
addr []string
}
func NewAPIHandler(addr ...string) *APIHandler {
return &APIHandler{
addr: addr,
}
}
func (h *APIHandler) Init(r *gin.Engine) {
h.router = r
}
func (h *APIHandler) Run() {
h.router.Run(h.addr...)
}
func (h *APIHandler) GetRouter() *gin.Engine {
return h.router
}