 routes = require(paths.entryPath + '/routes')
 
 config = null;
+
+stashPerf = (req, name, value) ->
+  if (config && config.stashPerf) 
+    config.stashPerf(req, name, value)
 
 # given a name, eg "listings#show"
 # return function that matches that controller's action (eg the show method of the listings controller)

      throw err
    else
      res.render('error_view', app: req.appContext, req: req);

getAuthenticate = (routeInfo) ->
  (req, res, next) ->


    start = new Date;
    action.call context, params, (err, template, data) ->
      stashPerf(req, "data", new Date - start)
      return handleErr(err, req, res) if err

      start = new Date;
      res.render(template, locals: data, app: req.appContext, req: req)
      stashPerf(req, "render", new Date - start)
      next()

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