Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DevelopmentConfig = Config{ DSN: "", HttpPort: 80, AutoTLS: false, Domains: []string{}, FriendlyLogging: true, } )
Functions ¶
func AddMiddlewares ¶
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func New ¶
New creates a minimal Server instance. This is a 'minimal' example of how to configure the library:
//go:embed assets
var embeddedFiles embed.FS
func embedFS(fs embed.FS) http.FileSystem {
return http.FS(fs)
}
type BaseRoutes struct{}
func (br *BaseRoutes) Register(e *echo.Echo) {
e.GET("/", func(c echo.Context) error {
return c.Render(200, "assets/index.html", nil)
})
}
func main() {
config := server.DevelopmentConfig
_ = fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=5432 sslmode=disable TimeZone=Europe/Oslo",
"localhost",
"postgres",
"postgres",
"tmp",
)
config.DSN = dsn
s := server.New(config, []provider.RouteProvider{
&BaseRoutes{},
}, []any{})
s.Init(embedFS(embeddedFiles))
}
func (*Server) Init ¶
func (s *Server) Init(fs http.FileSystem)
Click to show internal directories.
Click to hide internal directories.