Documentation ¶
Index ¶
Constants ¶
View Source
const ( // OrgIDKey is our context key for org id OrgIDKey = "org_id" // UserIDKey is our context key for user id UserIDKey = "user_id" // MaxRequestBytes is the max body size our web server will accept MaxRequestBytes int64 = 1048576 )
Variables ¶
This section is empty.
Functions ¶
func DecodeAndValidateForm ¶ added in v0.0.74
DecodeAndValidateForm takes the passed in form and attempts to parse and validate it from the URL query parameters as well as any POST parameters of the passed in request
func RegisterJSONRoute ¶ added in v0.0.74
func RegisterJSONRoute(method string, pattern string, handler JSONHandler)
func RegisterRoute ¶ added in v0.0.74
Types ¶
type JSONHandler ¶
func RequireAuthToken ¶ added in v0.0.74
func RequireAuthToken(handler JSONHandler) JSONHandler
RequireAuthToken wraps a handler to require that our request to have our global authorization header
func RequireUserToken ¶ added in v0.0.74
func RequireUserToken(handler JSONHandler) JSONHandler
type Server ¶
type Server struct { CTX context.Context RP *redis.Pool DB *sqlx.DB S3Client s3iface.S3API Config *config.Config // contains filtered or unexported fields }
func NewServer ¶
func NewServer(ctx context.Context, config *config.Config, db *sqlx.DB, rp *redis.Pool, s3Client s3iface.S3API, wg *sync.WaitGroup) *Server
NewServer creates a new web server, it will need to be started after being created
func (*Server) Start ¶
func (s *Server) Start()
Start starts our web server, listening for new requests
func (*Server) WrapHandler ¶ added in v0.0.74
func (s *Server) WrapHandler(handler Handler) http.HandlerFunc
WrapHandler wraps a simple Handler, taking care of passing down server and handling errors
func (*Server) WrapJSONHandler ¶ added in v0.0.74
func (s *Server) WrapJSONHandler(handler JSONHandler) http.HandlerFunc
WrapJSONHandler wraps a simple JSONHandler
Click to show internal directories.
Click to hide internal directories.