package
0.2.10
Repository: https://github.com/mwm-io/gapi.git
Documentation: pkg.go.dev

# Functions

Body return a preconfigured BodyDecoder with : - BodyDecoder.DefaultContentType = `application/json` - BodyDecoder.Decoders with all referenced Decoder.
JsonBody return a preconfigured BodyDecoder with : - BodyDecoder.ForcedContentType = `application/json`.
MakeJSONResponseWriter return an initialized ResponseWriter with all supported encoders (see EncoderByContentType) and ResponseWriter.ForcedContentType set to application/json.
MakeResponseWriter return an initialized ResponseWriter with all supported encoders (see EncoderByContentType) and ResponseWriter.DefaultContentType set to application/json.

# Variables

DecoderByContentType contain all built in decoders.
Defaults includes all default middlewares.
EncoderByContentType contain all built in decoders.

# Structs

BodyDecoder is a middleware that will Unmarshal the incoming request body into the Body field.
Log is a middleware that will: - set the given logger into the request's context.
PathParameters is a middleware that will set the request path parameters into the Parameters field.
QueryParameters is a middleware that will set the request query parameters into the Parameters field.
Recover middleware will recover from panics and return the panic details as error.
ResponseWriter is a middleware that will take the response from the next handler and write it into the response.

# Interfaces

BodyValidation interface can be implemented to trigger an auto validation by BodyDecoder middleware.
Decoder is able to unmarshal the body into a value.
Encoder is able to marshal.
WithStatusCode is able to return its http status code.

# Type aliases

FuncAsDecoder is function type that implements Decoder interface.
FuncAsEncoder is function type that implements Encoder interface.