Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadRequest return status 400 Bad Request for malformed request body. ErrBadRequest = &ErrResponse{StatusCode: http.StatusBadRequest, StatusText: http.StatusText(http.StatusBadRequest)} // ErrNotFound returns status 404 Not Found for invalid resource request. ErrNotFound = &ErrResponse{StatusCode: http.StatusNotFound, StatusText: http.StatusText(http.StatusNotFound)} // ErrInternalServerError returns status 500 Internal Server Error. ErrInternalServerError = &ErrResponse{StatusCode: http.StatusInternalServerError, StatusText: http.StatusText(http.StatusInternalServerError)} )
Functions ¶
func StartHTTPServer ¶
StartHTTPServer starts HTTP server on a given port, with database being used at dbDir.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API provides the application HTTP API
type ErrResponse ¶
type ErrResponse struct { Error error `json:"-"` // low-level runtime error StatusCode int `json:"-"` // http response status code StatusText string `json:"status"` // user-level status message }
ErrResponse renderer type for handling all sorts of errors.
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error
Render sets the application-specific error code in AppCode.
type PaymentResource ¶
type PaymentResource struct {
// contains filtered or unexported fields
}
PaymentResource implements payments management handler
func NewPaymentResource ¶
func NewPaymentResource(repo service.PaymentsRepository) *PaymentResource
NewPaymentResource creates and returns a payments resource.
Click to show internal directories.
Click to hide internal directories.