 stashError = (req, err) ->
   if (config && config.stashError)
     config.stashError(req, err)
- 
+
 
 getController = (controllerName) ->
   require("#{config.paths.controllerDir}/#{controllerName}_controller")


# define routes
exports.routes = () ->
  clientRoutes = require(config.paths.clientRouter)
  routeSpecs = []
  for own path, routeInfo of clientRoutes
    action = getAction(routeInfo)
    handler = getHandler(action, routeInfo)
    routeSpecs.push(['get', "/#{path}", routeInfo.role, handler])

  stashError(req, err)
  if (config && config.errorHandler)
    config.errorHandler(err, req, res)
  else
    # default error handler
    if (config && config.dumpExceptions)
      text = "Error: #{err.message}\n"
