stack

Home > @infiniteobjects/express-server > Utils

Utils class

Utilities to work with Requests

Signature:

export declare class Utils 

Methods

Method Modifiers Description
createHttpError(code) static Creates an HTTP ERROR
createHttpError(code, message) static  
createHttpError(code, props) static  
createHttpError(code, message, props) static  
createHttpError(err) static  
createHttpError(err, props) static  
createHttpError(code, err) static  
createHttpError(code, err, props) static  
createRouter(options) static Creates a router
getJwtToken(req, gatewayHeader) static Gets the JWT token from the request
getQueryValue(req, param, defaultValue) static Gets a value from the query
getQueryValue(req, param, defaultValue) static  
isHttpError(error) static Checks if an error is an HttpError
makeErrorStatus(error) static Makes an error status
makeStatus(message) static Makes an ok status
normalizeError(error) static Normalizes errors
throwHttpError(code) static Throws an http error
throwHttpError(code, message) static  
throwHttpError(code, props) static  
throwHttpError(code, message, props) static  
throwHttpError(err) static  
throwHttpError(err, props) static  
throwHttpError(code, err) static  
throwHttpError(code, err, props) static  
wrapAsyncRequestHandler(handler) static Wraps an async route in a try/catch
wrapAsyncRequestParamHandler(handler) static Wraps an async RequestParamHandler in a try/catch