This commit is contained in:
nic
2025-07-22 18:20:10 +03:00
commit a31b9310a2
12 changed files with 373 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package peer
import (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
type Server struct {
router *echo.Echo
}
func NewServer() *Server {
return &Server{
router: echo.New(),
}
}
func (s *Server) Configure() {
// Middleware
s.router.Use(middleware.Logger())
s.router.Use(middleware.Recover())
s.router.Use(middleware.CORS())
// Роуты
s.router.POST("/connect", s.connectHandler)
s.router.GET("/info", s.peerInfo)
}
func (s *Server) Run() error {
return s.router.Start(":8081")
}