bunexpress

package module
v0.0.0-...-845b50d Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BunHandlerFunc

func BunHandlerFunc(handler HandlerFunc) bunrouter.HandlerFunc

func BunMiddlewareFunc

func BunMiddlewareFunc(mdw MiddlewareFunc) bunrouter.MiddlewareFunc

Types

type DefaultHandler

type DefaultHandler struct {
	// contains filtered or unexported fields
}

func (DefaultHandler) ServeHTTP

func (h DefaultHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type Group

type Group struct {
	// contains filtered or unexported fields
}

func (Group) DELETE

func (g Group) DELETE(path string, handler HandlerFunc)

func (Group) GET

func (g Group) GET(path string, handler HandlerFunc)

func (Group) HEAD

func (g Group) HEAD(path string, handler HandlerFunc)

func (Group) Handle

func (g Group) Handle(method string, path string, handler HandlerFunc)

func (Group) LoadRoutes

func (g Group) LoadRoutes(routes []Route)

func (Group) NewGroup

func (g Group) NewGroup(path string, opts ...bunrouter.GroupOption) *Group

func (Group) OPTIONS

func (g Group) OPTIONS(path string, handler HandlerFunc)

func (Group) PATCH

func (g Group) PATCH(path string, handler HandlerFunc)

func (Group) POST

func (g Group) POST(path string, handler HandlerFunc)

func (Group) PUT

func (g Group) PUT(path string, handler HandlerFunc)

func (Group) WithGroup

func (g Group) WithGroup(path string, fn func(g *Group))

func (Group) WithMiddleware

func (g Group) WithMiddleware(middleware MiddlewareFunc) *Group

type HandlerFunc

type HandlerFunc func(req Request, res Response)

func FromBunHandlerFunc

func FromBunHandlerFunc(handler bunrouter.HandlerFunc) HandlerFunc

type MiddlewareFunc

type MiddlewareFunc func(next HandlerFunc) HandlerFunc

type Request

type Request struct {
	bunrouter.Request
}

type Response

type Response struct {
	http.ResponseWriter
}

func (Response) JSON

func (res Response) JSON(v any)

func (Response) Status

func (res Response) Status(statusCode int) Response

type Route

type Route struct {
	Path       string
	Method     string
	Handler    HandlerFunc
	Middleware MiddlewareFunc
	Children   []Route
	Options    []bunrouter.GroupOption
}

type Router

type Router struct {
	*bunrouter.Router
	*Group
}

func New

func New(router *bunrouter.Router) *Router

func (*Router) DefaultHandler

func (r *Router) DefaultHandler() DefaultHandler

Directories

Path Synopsis
example module

Jump to

Keyboard shortcuts

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