28 lines
361 B
Go
28 lines
361 B
Go
package http
|
|
|
|
import (
|
|
"go_oxspeak_server/network/http/handlers"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Server struct {
|
|
router *gin.Engine
|
|
addr string
|
|
}
|
|
|
|
func NewServer(addr string) *Server {
|
|
router := handlers.CreateRouter()
|
|
|
|
s := &Server{
|
|
router: router,
|
|
addr: addr,
|
|
}
|
|
|
|
return s
|
|
}
|
|
|
|
func (s *Server) Start() error {
|
|
return s.router.Run(s.addr)
|
|
}
|