 #   - errorHandler: function to correctly handle error
 #   - paths
 #     - entryPath (required)
-#     - clientRouter (optional)
+#     - routes (optional)
 #     - controllerDir (optional)
 #   - stashPerf: optional function to store performance stats
 #   - stashError: optional function to notify server of error

stashError = (req, err) ->
  if (config && config.stashError)
    config.stashError(req, err)
 

getController = (controllerName) ->
  require("#{config.paths.controllerDir}/#{controllerName}_controller")


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