agendas/server.go

34 lines
590 B
Go
Raw Normal View History

2024-12-23 20:57:58 -05:00
package main
import (
"context"
"fmt"
"git.agecem.com/bottin/bottin/v10/pkg/bottin"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func RunServer(ctx context.Context, bottinClient *bottin.APIClient) error {
select {
case <-ctx.Done():
return ctx.Err()
default:
if bottinClient == nil {
return fmt.Errorf("nil bottin client")
}
e := echo.New()
e.Renderer = NewRenderer()
e.Pre(middleware.AddTrailingSlash())
e.GET("/", UIIndex(ctx, bottinClient))
e.GET("/membre/", UIReadMembre(ctx, bottinClient))
return e.Start(":3333")
}
}