modulepackage
0.0.0-20210302114855-3975a26f6022
Repository: https://github.com/swithek/httpflow.git
Documentation: pkg.go.dev
# README
Barebones for common web applications:
- Root directory contains various request handling helpers (JSON decoding, errors with status codes, etc.)
user
package contains user auth/verification/recovery/etc. logic.email
package contains email sending functionality (useful when usinguser
package)
cmd
directory contains a working example backed by postgres database.
# Packages
No description provided by the author
Package email provides email sending functionality.
Package logutil provides helper functions for more convenient logging and error tracking.
Package testutil implements helper functions for more convenient testing and may be imported in '_test.go' files only.
Package timeutil implements helper functions for time-related logic which extends the functionality of the standard time package.
Package user provides user data handling functionality.
# Functions
DecodeForm decodes request's form values into destination object.
DecodeJSON decodes request's JSON body into destination object.
DetectError wraps the provided error with additional information useful for applications.
ErrorCode returns status code associated with the error.
ErrorMessage returns message associated with the error.
ExtractIP extracts request origin's IP address.
ExtractParam extracts a value by the the provided parameter name from the URL.
ExtractSession checks whether the session is present and returns it as well as user's ID.
ExtractTargetID extracts ID from the URL.
Location is a middleware that adds or expands location header.
MethodNotAllowed handles cases when request's method is not supported for the requested endpoint.
NewError creates a new status error by optionally wrapping another error.
NewLinks creates a new link store.
NotFound handles cases when request is sent to a non-existing endpoint.
Respond sends JSON type response to the client.
RespondError sends the provided error in a JSON format to the client.
SessionReject should be used as sessionup's rejection function.
# Constants
Link-prefixed constants define core link keys.
Link-prefixed constants define core link keys.
Link-prefixed constants define core link keys.
Link-prefixed constants define core link keys.
Link-prefixed constants define core link keys.
Link-prefixed constants define core link keys.
# Variables
ErrInvalidFilterKey is returned when filter key is determined to be invalid.
ErrInvalidForm is returned when request's form contains invalid JSON data.
ErrInvalidJSON is returned when request's body contains invalid JSON data.
ErrInvalidSortKey is returned when sort key is determined to be invalid.
ErrMethodNotAllowed is returned when request's method is not supported for the requested endpoint.
ErrNotFound is returned when target resource is not found.
ErrUnauthorized is returned when authorization process fails.
# Type aliases
LinkKey is used to access links in the map.