{"modulePath":"github.com/ping-cloudnative/moonlight-utils","version":"v0.0.0-20220913084520-91464782bcde","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package httpserver\n\n## Constants\n\n```go\nconst (\n\tPathFormatEcho       = 0\n\tPathFormatGoogleAPIs = 1\n)\n```\nPathFormat values\n\n## Functions\n\n```go\nfunc Var(r *http.Request, key string) (string, bool)\n```\nVar return the specified variable value and exist from the current request, if any.\n\n```go\nfunc Vars(r *http.Request) map[string]string\n```\nVars returns the route variables for the current request, if any.\n\n```go\nfunc WithDescription(desc string) interface{}\n```\nWithDescription for Route, description for this route\n\n```go\nfunc WithFileSystem(fs http.FileSystem) interface{}\n```\nWithFileSystem for Static And File\n\n```go\nfunc WithFileSystemPath(root string) interface{}\n```\nWithFileSystemPath for Static And File\n\n```go\nfunc WithHide(hide bool) interface{}\n```\nWithHide for Route, not print this route\n\n```go\nfunc WithInterceptor(fn func(handler func(ctx Context) error) func(ctx Context) error) interface{}\n```\nWithInterceptor for Router\n\n```go\nfunc WithPathFormat(format PathFormat) interface{}\n```\nWithPathFormat .\n\n## Types\n\n```go\ntype Context interface {\n\tSetAttribute(key string, val interface{})\n\tAttribute(key string) interface{}\n\tAttributes() map[string]interface{}\n\tRequest() *http.Request\n\tResponseWriter() http.ResponseWriter\n\tParam(name string) string\n\tParamNames() []string\n}\n```\nContext handler context.\n\n```go\ntype Interceptor func(handler func(ctx Context) error) func(ctx Context) error\n```\nInterceptor .\n\n```go\ntype LogConfig struct {\n\tMaxBodySizeBytes int `file:\"max_body_size_bytes\" default:\"1024\" desc:\"max body size in bytes\"`\n}\n```\nLogConfig .\n\n```go\ntype PathFormat int32\n```\nPathFormat .\n\n```go\ntype Response interface {\n\tStatus(Context) int\n\tReadCloser(Context) io.ReadCloser\n\tError(Context) error\n}\n```\nResponse .\n\n```go\ntype ResponseGetter interface {\n\tResponse(ctx Context) Response\n}\n```\nResponseGetter .\n\n```go\ntype Router interface {\n\tGET(path string, handler interface{}, options ...interface{})\n\tPOST(path string, handler interface{}, options ...interface{})\n\tDELETE(path string, handler interface{}, options ...interface{})\n\tPUT(path string, handler interface{}, options ...interface{})\n\tPATCH(path string, handler interface{}, options ...interface{})\n\tHEAD(path string, handler interface{}, options ...interface{})\n\tCONNECT(path string, handler interface{}, options ...interface{})\n\tOPTIONS(path string, handler interface{}, options ...interface{})\n\tTRACE(path string, handler interface{}, options ...interface{})\n\n\tAny(path string, handler interface{}, options ...interface{})\n\tStatic(prefix, root string, options ...interface{})\n\tFile(path, filepath string, options ...interface{})\n\n\tAdd(method, path string, handler interface{}, options ...interface{}) error\n}\n```\nRouter .\n\n```go\ntype RouterManager interface {\n\tNewRouter(opts ...interface{}) RouterTx\n\tReloadable() bool\n\tStarted() \u003c-chan struct{}\n}\n```\nRouterManager .\n\n```go\ntype RouterTx interface {\n\tRouter\n\tCommit() error\n\tRollback()\n\tReloadable() bool\n}\n```\nRouterTx .\n\n","path":"github.com/ping-cloudnative/moonlight-utils/providers/httpserver","name":"httpserver","synopsis":"","isRedistributable":true}
