forked from ebhomengo/niki
38 lines
691 B
Go
38 lines
691 B
Go
package patientapp
|
|
|
|
import (
|
|
"git.gocasts.ir/ebhomengo/niki/patientapp/config"
|
|
"git.gocasts.ir/ebhomengo/niki/patientapp/delivery/http/analytic"
|
|
"git.gocasts.ir/ebhomengo/niki/patientapp/repository/mysql"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
type Application struct {
|
|
//Config Config
|
|
HTTPServer *config.EchoServer
|
|
DB *mysql.DataBase
|
|
}
|
|
|
|
func Setup(cfg config.Config, conn *mysql.DataBase) Application {
|
|
|
|
e := echo.New()
|
|
|
|
server := config.EchoServer{
|
|
Router: e,
|
|
Config: cfg,
|
|
}
|
|
|
|
return Application{
|
|
//Config: config,
|
|
HTTPServer: &server,
|
|
DB: conn,
|
|
}
|
|
}
|
|
|
|
func (a Application) Start() {
|
|
|
|
server := analytic.NewServer(a.HTTPServer)
|
|
|
|
_ = server.Serve()
|
|
}
|