Purpose unknown

@param {unknown} sessions unknown
@param {unknown} controllers unknown
@param {unknown} req unknown
@param {unknown} res unknown
@param {unknown} next unknown
963549
function downloadRouter(sessions, controllers, nonObjTemplatelogLevel, req, res, next) {
    let file = url.parse(req.originalUrl, true).query.file;

    if (req.originalUrl.match(/amorphic\/xhr\?path\=/) && file && req.method === 'GET') {
        processContentRequest(req, res, sessions, controllers, nonObjTemplatelogLevel);
    }
    else {
        next();
    }
}
1001193
function get_user_collection(req, res, next) {
		app.db.collection('users', function(error, user_collection) {
			if(error) { throw error; }
			else {
				req.user_collection = user_collection;
				next();
			}
		});
	}
216623
function get(req, res, next) {

  //Admin Fields And Data Sources Should Not Be Shown For App Requests
  var showAdminAndDataSources = !req.params.projectid;

  var getParams = {
    "_id": req.params.id,
    "showAdminFields": showAdminAndDataSources,
    includeDataSources: showAdminAndDataSources,
    //Data Source Caches are required for app requests
    expectDataSourceCache: !showAdminAndDataSources
  };

  logger.debug("Middleware: Get form: ", {getParams: getParams});

  forms.getForm(_.extend(req.connectionOptions, getParams), formsResultHandlers(constants.resultTypes.forms, req, next));
}
277907
function undeploy(req, res, next) {
  var removeParams = {
    _id: req.params.id
  };

  logger.debug("Middleware: undeploy form: ", {params: removeParams});

  forms.deleteForm(_.extend(req.connectionOptions, removeParams), formsResultHandlers(constants.resultTypes.forms, req, next));
}
135441
function StartSession(app, next) {
    this.__app = app;
    this.__next = next;

    /**
     * Session config
     */
    this.__config = this.__app.config.get('session');

    this.sessionHandler = app.sessionHandler;
}
266093
function resolveRequest({ requestKey, res, err }) {
  const handlers = requests[requestKey] || [];

  handlers.forEach(handler => {
    if (res) {
      handler.resolve(res);
    } else {
      handler.reject(err);
    }
  });

  // This list of handlers has been, well, handled. So we
  // clear the handlers for the next request.
  requests[requestKey] = null;
}
209450
def _wrap_sessions(sessions, request):
    
    result = set()
    for s in sessions:
        if s is SELF and request:
            result.add(request.session.session_key)
        else:
            result.add(s)
    return result
1154201
function pages(req, res, next) {

    generator.getPage(req.url, function(err, page) {

      if (err || !page || !checkMethod(req, page)) return next();

      if (!isPageAuthorized(req, page)) {
        if (!server.login || page.nologin) return next();
        return server.login(req, res);
      }

      debug('page %s', page._href);

      // make req and res available to dynamic pages
      generator.req = req;
      generator.res = res;

      resHeaders(res, page);
      res.send(generator.renderDoc(page));

    });
  }
199685
function (req, res, options) {
    if (!options) {
      options = {};
    }
    options.operation = 'REMOVE';
    options.res = res;
    if (!options) {
      options = {};
    }
    if (req.params.model) {
      options.model = req.params.model;
    }
    if (req.params.query) {
      options.query = req.params.query;
    }
    if (req.params.id) {
      options.query = {
        _id: req.params.id,
      };
    }
    exports.remove.before(req, res, options);
    var userId = req.session['user-id'];
    vulpejs.models.remove({
      model: options.model,
      item: {
        _id: req.params.id,
      },
      query: options.query,
      validate: options.validate || false,
      userId: userId,
      callback: {
        success: function (item) {
          if (!vulpejs.utils.execute(options.callback, {
              item: item,
              res: res,
            })) {
            exports.remove.after(req, res, item);
            res.json({
              item: item,
            });
          }
        },
        error: function (error) {
          exports.response.error(options, error);
        },
        validate: function (validate) {
          exports.response.validate(options, validate);
        },
      },
    });
  }
970508
function makeSession(session) {
  return {
    authenticated: !!session.token,
    token: session.token,
    scope: session.scope,
    error: session.error,
    errorDescription: session.errorDescription
  };
}
1115262
function(callback) {
    // Activate current
    var current = $state.current();

    if(current) {

      // Reset
      _resetActive().then(function() {

        // Render
        var viewsPromised = {};
        var templates = current.templates || {};
        var controllers = current.controllers || {};
        angular.forEach(templates, function(template, id) {
          if(_viewHash[id]) {
            var view = _viewHash[id];
            var controller = controllers[id];
            viewsPromised[id] = _renderView(id, view, template, controller);
            _activeSet[id] = view;
          }
        });

        $q.all(viewsPromised).then(function() {
          callback();
        }, callback);

      }, callback);

    // None
    } else {
      callback();
    }
  }
75424
function (app, next) {
      app.use(function (req, res, next) {
        router.handle(req, res, next);
      });

      next(null, app);
    }
777214
function teamOutAction() {
        sessionStore.get(sessionId, function aa(_error, expressSession) {
            if (!expressSession) {
                log(1, sessionId, 'Session has expired', nonObjTemplatelogLevel);
            }

            if (!expressSession ||
                cachedController.controller.__template__.objectTemplate.getPendingCallCount() === 0) {
                controllers[sessionId + path] = null;
                log(1, sessionId, 'Expiring controller cache for ' + path, nonObjTemplatelogLevel);
            }
            else {
                cachedController.timeout = setTimeout(timeoutAction, objectCacheExpiration);
                log(2, sessionId, 'Extending controller cache timeout because of pending calls for ' + path,
 -                    nonObjTemplatelogLevel);
            }
        });
    }
99712
function queryController(requestUri) {
    try {
        if (requestUri === undefined)
            return null;
        //split path
        var segments = requestUri.pathname.split('/');
        //put an exception for root controller
        //maybe this is unnecessary exception but we need to search for root controller e.g. /index.html, /about.html
        if (segments.length === 2)
            return 'root';
        else
        //e.g /pages/about where segments are ['','pages','about']
        //and the controller of course is always the second segment.
            return segments[1];
    }
    catch (err) {
        throw err;
    }
}
1124770
function reqres(res, req) {
    if (req && req._headers) {
        throw new Error('Received response object where request object was expected');
    }
    this.res = res;
    this.req = req;
    if (res) {
        if (res.$ && res.$.data) {
            this.data = res.$.data;
        }
        else {
            this.data = { error: null };
            if (!res.$) {
                res.$ = this;
            }
        }
    }
}
474320
function middleware(req, res, next) {
  req.security.csrf.exclude = true;
  next();
}
944905
def setup_controller_params(controller, env, vars)
      if Fastr::HTTP.method?(env, :get)
        controller.get_params = Fastr::HTTP.parse_query_string(env['QUERY_STRING'])
        controller.params = controller.get_params.merge(vars)
      elsif Fastr::HTTP.method?(env, :post)
        controller.post_params = {}
        controller.post_params = Fastr::HTTP.parse_query_string(env['rack.input'].read) if env['rack.input']
        controller.params = controller.post_params.merge(vars)
      else
        controller.params = vars
      end
    end