forked from ebhomengo/niki
1
0
Fork 0
niki/delivery/http_server/end2end/setup/server.go

26 lines
528 B
Go
Raw Permalink Normal View History

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"
"github.com/labstack/echo/v4"
)
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)
}