package
2.1.0+incompatible
Repository: https://github.com/ant0ine/go-json-rest.git
Documentation: pkg.go.dev
# Functions
Error produces an error response in JSON with the following structure, '{"Error":"My error message"}' The standard plain text net/http Error helper can still be called like this: http.Error(w, "error message", code).
NotFound produces a 404 response with the following JSON, '{"Error":"Resource not found"}' The standard plain text net/http NotFound helper can still be called like this: http.NotFound(w, r.Request).
RouteObjectMethod creates a Route that points to an object method.
WrapMiddlewares calls the MiddlewareFunc methods in the reverse order and returns an HandlerFunc ready to be executed.
# Constants
NCSA extended/combined log format.
Common Log Format (CLF).
Default format, colored output and response time, convenient for development.
# Structs
When EnableLogAsJson is true, this object is dumped as JSON in the Logger.
AuthBasicMiddleware provides a simple AuthBasic implementation.
CorsInfo contains the CORS request info derived from a rest.Request.
CorsMiddleware provides a configurable CORS implementation.
JsonpMiddleware provides JSONP responses on demand, based on the presence of a query string argument specifying the callback name.
Request inherits from http.Request, and provides additional methods.
ResourceHandler implements the http.Handler interface and acts a router for the defined Routes.
Route defines a route.
Status contains stats and status information.
# Interfaces
Middleware defines the interface that objects must implement in order to wrap a HandlerFunc and be used in the middleware stack.
A ResponseWriter interface dedicated to JSON HTTP response.
# Type aliases
AccessLogFormat defines the format of the access log record.
HandlerFunc defines the handler function.