go-cook-portal/cmd/main.go

32 lines
678 B
Go

package main
import (
"fmt"
"templ-test/client"
"templ-test/handlers"
"templ-test/services"
"github.com/gorilla/sessions"
"github.com/labstack/echo-contrib/session"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
cfg := services.NewEnvConfig()
// connect to api server
apiClient := client.New(cfg.ApiServerUri)
e := echo.New()
e.Use(session.Middleware(sessions.NewCookieStore([]byte(cfg.CookieSecret))))
e.Pre(middleware.Logger())
handler := e.Group("")
portalClient := handlers.NewHandlerClient(apiClient, cfg)
portalClient.Register(*handler)
fmt.Println("Listening on :1324")
e.Logger.Fatal(e.Start(":1324"))
}