echo

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bundle added in v0.1.2

func Bundle() sen.Plugin

Bundle is a sen.Plugin that provides both Config and echo.Echo for convenience.

Usage

app.With(echo.Module())

Types

type Config

type Config struct {
	Port string `env:"PORT,required" envDefault:"1323"`
}

Config includes configuration to initialize an echo server.

type ConfigProvider

type ConfigProvider struct {
	Hub sen.Hub `inject:"hub"`
}

ConfigProvider is a plugin that provides Config for initializing echo.

Usage

app.With(&echo.ConfigProvider{})

func (ConfigProvider) Initialize

func (p ConfigProvider) Initialize() error

Initialize loads Config from environment variables and registers it to the application.

type Plugin

type Plugin struct {
	Middlewares []echo.MiddlewareFunc

	// will be injected
	LC  sen.Lifecycle `inject:"lifecycle"`
	Hub sen.Hub       `inject:"hub"`
	Cfg *Config       `inject:"echo.config"`
}

Plugin is a plugin that provides an instance of echo.Echo. The plugin requires Config is registered in advance.

Usage

app.With(&echo.Plugin{
	Middlewares: middlewaresFuncs,
})

func (Plugin) Initialize

func (p Plugin) Initialize() error

Initialize initializes and registers the echo.Echo instance with the provided middlewares.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL