feat: Hub接收RESTful API的消息

This commit is contained in:
2025-12-16 17:15:59 +08:00
parent 18874711ea
commit b824dc3792
6 changed files with 74 additions and 7 deletions

View File

@ -4,13 +4,15 @@ import (
"net/http"
"git.jinshen.cn/remilia/push-server/interval/api/handler"
"git.jinshen.cn/remilia/push-server/interval/hub"
"github.com/go-chi/chi/v5"
)
func NewRouter() http.Handler {
func NewRouter(h *hub.Hub) http.Handler {
r := chi.NewRouter()
r.Post("/health", handler.Health)
r.Post("/push/{topic}", handler.PushHandler(h))
return r
}