Onyx-API/internal/server/server.go
2023-09-15 18:21:04 +02:00

31 lines
443 B
Go
Executable File

package server
import (
"log"
"onyx-api/internal/config"
"github.com/labstack/echo/v4"
)
var err error
type Server struct {
router *echo.Echo
config *config.Config
}
func NewServer(cfg *config.Config) *Server {
return &Server{config: cfg, router: echo.New()}
}
func (s *Server) Run() error {
err = s.router.Start(":" + s.config.AppPortListen)
if err != nil {
log.Printf("Error starting Server")
return err
}
return nil
}