lib/requestFilter.js
function configure(options) {
  options = options || {};
  var assertErrTemplate = '[connect-spa-request-filter middleware :: configure()] Fatal error! Missing parameter:';

  assert(options.appConfig, util.format(assertErrTemplate, 'options.appConfig'));
  assert(options.appConfig.appTitle, util.format(assertErrTemplate, 'options.appConfig.appTitle'));

  appConfig        = options.appConfig;
  appData          = options.appData  || {};
  appShell         = options.appShell || {};
  voidFilterRoutes = options.voidFilterRoutes || [];

  appShell.view    = appShell.view   || 'index';
  appShell.layout  = appShell.layout || false;


  // Publicly expose the module interface after initialized
  return requestFilter;
}
function configure(options) {
  options = options || {};
  var assertErrTemplate = '[connect-spa-request-filter middleware :: configure()] Fatal error! Missing parameter:';

  assert(options.appConfig, util.format(assertErrTemplate, 'options.appConfig'));
  assert(options.appConfig.appTitle, util.format(assertErrTemplate, 'options.appConfig.appTitle'));

  appConfig        = options.appConfig;
  appData          = options.appData  || {};
  appShell         = options.appShell || {};
  voidFilterRoutes = options.voidFilterRoutes || [];

  appShell.view    = appShell.view   || 'index';
  appShell.layout  = appShell.layout || false;


  // Publicly expose the module interface after initialized
  return requestFilter;
}
function configure ( options ) { options = options || { } ; var assertErrTemplate = '[connect-spa-request-filter middleware :: configure()] Fatal error! Missing parameter:' ; assert ( options . appConfig , util . format ( assertErrTemplate , 'options.appConfig' ) ) ; assert ( options . appConfig . appTitle , util . format ( assertErrTemplate , 'options.appConfig.appTitle' ) ) ; appConfig = options . appConfig ; appData = options . appData || { } ; appShell = options . appShell || { } ; voidFilterRoutes = options . voidFilterRoutes || [ ] ; appShell . view = appShell . view || 'index' ; appShell . layout = appShell . layout || false ; // Publicly expose the module interface after initialized return requestFilter ; }
Initializes the middleware by setting the required options for it to run
and exposing the filtering interface
@param  {object}   options   Options object containing the following:
* app: A reference to the Express app object
* voidFilterRoutes: an array of routes (paths) to void filtering on
@return {function}           The requestFilter function doing the filtering
@author Tomislav Capan
Initializes the middleware by setting the required options for it to run and exposing the filtering interface