Documentation
¶
Index ¶
- func Banner(addr string) string
- func CenterText(text string) string
- type App
- func (a *App) Add(methods []string, path string, h core.Handler, hs ...core.Handler) *router.Route
- func (a *App) All(path string, handler core.Handler, handlers ...core.Handler) *router.Route
- func (a *App) Connect(path string, h core.Handler, hs ...core.Handler) *router.Route
- func (a *App) Delete(path string, handler core.Handler, handlers ...core.Handler) *router.Route
- func (a *App) Get(path string, handler core.Handler, handlers ...core.Handler) *router.Route
- func (a *App) GetFast(path string, handler fasthttp.RequestHandler) *router.Route
- func (a *App) Group(prefix string, middlewares ...core.Handler) *Group
- func (a *App) Handler() fasthttp.RequestHandler
- func (a *App) Head(path string, handler core.Handler, handlers ...core.Handler) *router.Route
- func (a *App) MethodNotAllowed(h core.Handler) *App
- func (a *App) NotFound(h core.Handler) *App
- func (a *App) Options(path string, handler core.Handler, handlers ...core.Handler) *router.Route
- func (a *App) Patch(path string, handler core.Handler, handlers ...core.Handler) *router.Route
- func (a *App) Post(path string, handler core.Handler, handlers ...core.Handler) *router.Route
- func (a *App) Put(path string, handler core.Handler, handlers ...core.Handler) *router.Route
- func (a *App) Route(path string) *router.Route
- func (a *App) RunServer(addr string) error
- func (a *App) RunTLSServer(addr, certFile, keyFile string) error
- func (a *App) RunWithGracefulShutdown(addr string) error
- func (a *App) SetErrorHandler(fn func(*core.Context, error)) *App
- func (a *App) Shutdown(ctx context.Context) error
- func (a *App) Static(prefix, dir string) *App
- func (a *App) Templates(dir string) *App
- func (a *App) Test(req *http.Request) *http.Response
- func (a *App) Use(args ...any) *App
- func (a *App) WithCache() *App
- func (a *App) WithPubsub() *App
- func (a *App) WithQueue() *App
- func (a *App) WrapHandlers(hs []core.Handler) fasthttp.RequestHandler
- type Group
- func (g *Group) Add(methods []string, path string, h core.Handler, hs ...core.Handler) *router.Route
- func (g *Group) All(path string, h core.Handler, hs ...core.Handler) *router.Route
- func (g *Group) Delete(path string, h core.Handler, hs ...core.Handler) *router.Route
- func (g *Group) Get(path string, h core.Handler, hs ...core.Handler) *router.Route
- func (g *Group) Options(path string, h core.Handler, hs ...core.Handler) *router.Route
- func (g *Group) Patch(path string, h core.Handler, hs ...core.Handler) *router.Route
- func (g *Group) Post(path string, h core.Handler, hs ...core.Handler) *router.Route
- func (g *Group) Put(path string, h core.Handler, hs ...core.Handler) *router.Route
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CenterText ¶
Types ¶
type App ¶
type App struct {
EngineCtx *core.EngineContext
ErrorHandler func(*core.Context, error)
// contains filtered or unexported fields
}
func (*App) Handler ¶
func (a *App) Handler() fasthttp.RequestHandler
func (*App) RunTLSServer ¶
func (*App) RunWithGracefulShutdown ¶
func (*App) Test ¶
Test runs req through the full application (router, middleware, recovery) without opening a network listener, and returns the recorded response. It is meant for tests:
req := httptest.NewRequest(http.MethodGet, "/user/42", nil)
resp := app.Test(req)
if resp.StatusCode != http.StatusOK { ... }
body, _ := io.ReadAll(resp.Body)
The response body is buffered, so it stays readable after the call. The handler is cached after the first call; routes registered later are still matched because the router rebuilds its table lazily.
func (*App) WithPubsub ¶
func (*App) WrapHandlers ¶
func (a *App) WrapHandlers(hs []core.Handler) fasthttp.RequestHandler
Click to show internal directories.
Click to hide internal directories.