Documentation ¶
Index ¶
- Constants
- Variables
- func Clear()
- func ErrorPageFunc(c echo.Context) error
- func FixedUploadURLPrefix() echo.MiddlewareFuncd
- func HostChecker(key string) echo.MiddlewareFuncd
- func MaxRequestBodySize(h echo.Handler) echo.HandlerFunc
- func ProcessError(ctx echo.Context, err error) error
- func SearchEngineNoindex() echo.MiddlewareFuncd
- func Transaction() echo.MiddlewareFunc
- func TrimPathSuffix(ignorePrefixes ...string) echo.MiddlewareFuncd
- type HTTPServer
- func (h *HTTPServer) Apply()
- func (h *HTTPServer) Clear()
- func (h *HTTPServer) GetStaticMW() echo.MiddlewareFunc
- func (h *HTTPServer) I18n() *language.Language
- func (h *HTTPServer) Prefix() string
- func (h *HTTPServer) Renderer() driver.Driver
- func (h *HTTPServer) SetKeepExtensionPrefixes(keepExtensionPrefixes []string) *HTTPServer
- func (h *HTTPServer) SetNavigate(nav *navigate.ProjectNavigates) *HTTPServer
- func (h *HTTPServer) SetPrefix(prefix string) *HTTPServer
- func (h *HTTPServer) SetRenderDataWrapper(dataWrapper echo.DataWrapper) *HTTPServer
- func (h *HTTPServer) SetRouter(router route.IRegister) *HTTPServer
- func (h *HTTPServer) SetTmplCustomParser(parser func(tmpl string, content []byte) []byte) *HTTPServer
- type HTTPServers
Constants ¶
View Source
const ( KindBackend = `backend` KindFrontend = `frontend` )
Variables ¶
View Source
var ( Backend = New(KindBackend). SetRouter(route.NewRegister(defaults.Default).AddGroupNamer(groupNamer)). SetNavigate(navigate.NewProjectNavigates(`nging`)) Frontend = New(KindFrontend).SetNavigate(navigate.NewProjectNavigates(`webx`)) Servers = &HTTPServers{ Backend: Backend, Frontend: Frontend, } )
View Source
var (
EmptyURL = &url.URL{}
)
View Source
var ErrorProcessors = []render.ErrorProcessor{ func(ctx echo.Context, err error) (processed bool, newErr error) { if errors.Is(err, db.ErrNoMoreRows) { return true, echo.NewError(ctx.T(`数据不存在`), code.DataNotFound) } return false, err }, }
Functions ¶
func ErrorPageFunc ¶
func FixedUploadURLPrefix ¶ added in v0.3.14
func FixedUploadURLPrefix() echo.MiddlewareFuncd
func HostChecker ¶ added in v0.3.1
func HostChecker(key string) echo.MiddlewareFuncd
func MaxRequestBodySize ¶
func MaxRequestBodySize(h echo.Handler) echo.HandlerFunc
func SearchEngineNoindex ¶ added in v0.3.15
func SearchEngineNoindex() echo.MiddlewareFuncd
func Transaction ¶
func Transaction() echo.MiddlewareFunc
func TrimPathSuffix ¶ added in v0.3.1
func TrimPathSuffix(ignorePrefixes ...string) echo.MiddlewareFuncd
Types ¶
type HTTPServer ¶
type HTTPServer struct { Name string Router route.IRegister Dashboard *dashboard.Dashboard Template *ntemplate.Template TmplMgr driver.Manager // for web framework StaticOptions *middleware.StaticOptions StaticMW echo.MiddlewareFunc KeepExtensionPrefixes []string RouteDefaultExtension string DefaultTemplateDir string // 模板路径默认值 DefaultAssetsDir string // 素材路径默认值 DefaultAssetsURLPath string // 素材网址路径默认值 DefaultStaticRootURL string StaticRootURLPath string TemplateDir string //模板文件夹 AssetsDir string //素材文件夹 AssetsURLPath string //素材网址路径 DefaultAvatarURL string //默认头像网址 RendererDo func(driver.Driver) //模板引擎配置函数 TmplCustomParser func(tmpl string, content []byte) []byte //模板自定义解析函数 ParseStrings map[string]string //模板内容替换 ParseStringFuncs map[string]func() string //模板内容替换函数 Middlewares []interface{} GlobalFuncMap map[string]interface{} FuncSetters []func(echo.Context) error HostCheckerRegexpKey string // contains filtered or unexported fields }
func New ¶
func New(kind string) *HTTPServer
func (*HTTPServer) Apply ¶
func (h *HTTPServer) Apply()
func (*HTTPServer) Clear ¶
func (h *HTTPServer) Clear()
func (*HTTPServer) GetStaticMW ¶ added in v0.3.3
func (h *HTTPServer) GetStaticMW() echo.MiddlewareFunc
func (*HTTPServer) I18n ¶
func (h *HTTPServer) I18n() *language.Language
func (*HTTPServer) Prefix ¶
func (h *HTTPServer) Prefix() string
func (*HTTPServer) Renderer ¶
func (h *HTTPServer) Renderer() driver.Driver
func (*HTTPServer) SetKeepExtensionPrefixes ¶ added in v0.3.1
func (h *HTTPServer) SetKeepExtensionPrefixes(keepExtensionPrefixes []string) *HTTPServer
func (*HTTPServer) SetNavigate ¶
func (h *HTTPServer) SetNavigate(nav *navigate.ProjectNavigates) *HTTPServer
func (*HTTPServer) SetPrefix ¶
func (h *HTTPServer) SetPrefix(prefix string) *HTTPServer
func (*HTTPServer) SetRenderDataWrapper ¶ added in v0.3.1
func (h *HTTPServer) SetRenderDataWrapper(dataWrapper echo.DataWrapper) *HTTPServer
func (*HTTPServer) SetRouter ¶
func (h *HTTPServer) SetRouter(router route.IRegister) *HTTPServer
func (*HTTPServer) SetTmplCustomParser ¶ added in v0.3.1
func (h *HTTPServer) SetTmplCustomParser(parser func(tmpl string, content []byte) []byte) *HTTPServer
type HTTPServers ¶
type HTTPServers struct { Backend *HTTPServer Frontend *HTTPServer }
func (*HTTPServers) Clear ¶
func (a *HTTPServers) Clear()
Click to show internal directories.
Click to hide internal directories.