ServerUtils

server. ServerUtils

Server-related utilities

Constructor

new ServerUtils()

Source:

Methods

(static) addErrorHandler(next)

Description:
  • Adds extra properties to the request object to allow for easy translations
Source:
Parameters:
Name Type Description
next function

(static) apiNotFoundHandler(req, res, next)

Description:
  • Middleware for handling 404 errors on the API router
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async, static) debugRequestTime(req, res, next)

Description:
  • Adds logs for debugging each request time
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(static) genericErrorHandler(error, req, res, next)

Description:
  • Generic error handling middleware for the API router
Source:
Parameters:
Name Type Description
error Error
req external:ExpressRequest
res external:ExpressResponse
next function

(async, static) handleInternalRoutes(req, res, next)

Description:
  • Handles restriction of routes marked as internal
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(static) methodNotAllowedHandler(router) → {function}

Description:
  • Middleware for handling 405 Method Not Allowed errors Checks if the requested path exists with a different HTTP method
Source:
Parameters:
Name Type Description
router Router The router to check routes against
Returns:
Middleware function
Type
function

(static) rootNotFoundHandler(req, res)

Description:
  • Middleware for handling 404 errors on the root router
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse