func StartServer(config Config, db domain.LostPetsRepo, fileDb domain.FileRepo, fileStore domain.FileStore, logger domain.StructuredLogger, version string) {

	e := echo.New()

	// Middleware
	e.Use(middleware.Logger())
	e.Use(middleware.Recover())

	e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
		Skipper:      middleware.DefaultSkipper,
		AllowOrigins: []string{"*"},
		AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodPut, http.MethodPatch, http.MethodPost, http.MethodDelete},
		AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept, echo.HeaderLocation},
	}))

	emailer := emailer{config: config.Email, logger: logger}

	fileHandler := fileHandler{logger: logger, fileRepo: fileDb, fileStore: fileStore, router: e}
	fileHandler.initRoute(filePath)

	postingHandler := postingsHandler{logger: logger, router: e, repo: db, emailer: emailer}
	postingHandler.initRoute(postingsPath)

	sightingHandler := sightingsHandler{logger: logger, router: e, repo: db, emailer: emailer}
	sightingHandler.initRoute(sightingsPath)

	e.GET("/pet-types", getPetTypesHandler(db))

	e.GET("/", apiInfoHandler(version, config.Debug))

	if config.Debug {
		data, _ := json.MarshalIndent(e.Routes(), "", "  ")
		log.Print(string(data))
	}

	if err := e.Start(":8080"); err != http.ErrServerClosed {
		log.Fatal(err)
	}
}
/*StartServer configures and starts a new http server*/
StartServer configures and starts a new http server
/ * StartServer configures and starts a new http server * /
func StartServer(config Config, db domain.LostPetsRepo, fileDb domain.FileRepo, fileStore domain.FileStore, logger domain.StructuredLogger, version string) {
	e := echo.New()
	e.Use(middleware.Logger())
	e.Use(middleware.Recover())
	e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
		Skipper:      middleware.DefaultSkipper,
		AllowOrigins: []string{"*"},
		AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodPut, http.MethodPatch, http.MethodPost, http.MethodDelete},
		AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept, echo.HeaderLocation},
	}))
	emailer := emailer{config: config.Email, logger: logger}
	fileHandler := fileHandler{logger: logger, fileRepo: fileDb, fileStore: fileStore, router: e}
	fileHandler.initRoute(filePath)
	postingHandler := postingsHandler{logger: logger, router: e, repo: db, emailer: emailer}
	postingHandler.initRoute(postingsPath)
	sightingHandler := sightingsHandler{logger: logger, router: e, repo: db, emailer: emailer}
	sightingHandler.initRoute(sightingsPath)
	e.GET("/pet-types", getPetTypesHandler(db))
	e.GET("/", apiInfoHandler(version, config.Debug))
	if config.Debug {
		data, _ := json.MarshalIndent(e.Routes(), "", "  ")
		log.Print(string(data))
	}
	if err := e.Start(":8080"); err != http.ErrServerClosed {
		log.Fatal(err)
	}
}
func StartServer ( config Config , db domain . LostPetsRepo , fileDb domain . FileRepo , fileStore domain . FileStore , logger domain . StructuredLogger , version string ) { e := echo . New ( ) e . Use ( middleware . Logger ( ) ) e . Use ( middleware . Recover ( ) ) e . Use ( middleware . CORSWithConfig ( middleware . CORSConfig { Skipper : middleware . DefaultSkipper , AllowOrigins : [ ] string { " " } , AllowMethods : [ ] string { http . MethodGet , http . MethodHead , http . MethodPut , http . MethodPatch , http . MethodPost , http . MethodDelete } , AllowHeaders : [ ] string { echo . HeaderOrigin , echo . HeaderContentType , echo . HeaderAccept , echo . HeaderLocation } , } ) ) emailer := emailer { config : config . Email , logger : logger } fileHandler := fileHandler { logger : logger , fileRepo : fileDb , fileStore : fileStore , router : e } fileHandler . initRoute ( filePath ) postingHandler := postingsHandler { logger : logger , router : e , repo : db , emailer : emailer } postingHandler . initRoute ( postingsPath ) sightingHandler := sightingsHandler { logger : logger , router : e , repo : db , emailer : emailer } sightingHandler . initRoute ( sightingsPath ) e . GET ( " " , getPetTypesHandler ( db ) ) e . GET ( " " , apiInfoHandler ( version , config . Debug ) ) if config . Debug { data , _ := json . MarshalIndent ( e . Routes ( ) , " " , " " ) log . Print ( string ( data ) ) } if err := e . Start ( " " ) ; err != http . ErrServerClosed { log . Fatal ( err ) } }
StartServer configures and starts a new http server
StartServer configures and starts a new http server
// Middleware