2024-08-06 11:49:46 +00:00
|
|
|
package setup
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"git.gocasts.ir/ebhomengo/niki/config"
|
|
|
|
httpserver "git.gocasts.ir/ebhomengo/niki/delivery/http_server"
|
|
|
|
"git.gocasts.ir/ebhomengo/niki/service"
|
2024-09-10 20:55:19 +00:00
|
|
|
"github.com/labstack/echo/v4"
|
2024-08-06 11:49:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type TestServer struct {
|
|
|
|
router *echo.Echo
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewTestServer(cfg config.Config, svc *service.Service) *TestServer {
|
|
|
|
s := httpserver.New(cfg, svc)
|
|
|
|
s.RegisterRoutes()
|
|
|
|
|
|
|
|
return &TestServer{router: s.Router}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *TestServer) Serve(w http.ResponseWriter, r *http.Request) {
|
|
|
|
t.router.ServeHTTP(w, r)
|
|
|
|
}
|