docs: function configureMiddlewares(app, config) {
      config = config || {};
  
      // setup request helpers
      utils.extendHttpRequest();
  
      // setup response helpers
      utils.extendHttpResponse();
  
      //
      // order is meaningful for some express middlewares
      //
  
      // NOTE: this should be the first middleware
      if (config.logger) {
          app.use(require('./logger')(config.logger));
      }
  
      // NOTE: this should be placed "high" within middleware stack
      if (config.compress || config.compression) {
          app.use(require('compression')(config.compress || config.compression));
      }
  
      // NOTE: this should be before "session" middleware using "cookie store"
      if (config.cookieParser) {
          app.use(require('cookie-parser')(config.cookieParser));
      }
  
      // "_method" body param or "x-http-method-override' header
      if (config.methodOverride) {
          app.use(require('method-override')(config.methodOverride));
      }
  
      // "cors" request
      if (config.cors) {
          app.use(require('./cors')(config.cors));
      }
  
      // NOTE: this should be before "passport" middlewares
      if (config.session) {
          app.use(require('./session')(config.session));
      }
  
      // this should be after "session" middleware
      if (config.csrf || config.csurf) {
          app.use(require('csurf')(config.csrf || config.csurf));
      }
  
      // multipart/form-data
      if (config.multipart) {
          app.use(require('./multipart')(config.multipart));
      }
  
      // application/json
      if (config.json) {
          app.use(require('body-parser').json(config.json));
      }
  
      // application/x-www-form-urlencoded
      if (config.urlencoded) {
          config.urlencoded.extended = !!config.urlencoded.extended;
          app.use(require('body-parser').urlencoded(config.urlencoded));
      }
  
      // plain/text
      if (config.text) {
          app.use(require('body-parser').text(config.text));
      }
  
      // application/octet-stream
      if (config.raw) {
          app.use(require('body-parser').raw(config.text));
      }
  
      return app;
  }