Advertisement
francfooter

Sails http.js ver 0.10.5

Dec 2nd, 2014
984
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * HTTP Server Settings
  3.  * (sails.config.http)
  4.  *
  5.  * Configuration for the underlying HTTP server in Sails.
  6.  * Only applies to HTTP requests (not WebSockets)
  7.  *
  8.  * For more information on configuration, check out:
  9.  * http://sailsjs.org/#/documentation/reference/sails.config/sails.config.http.html
  10.  */
  11.  
  12. module.exports.http = {
  13.  
  14.   /****************************************************************************
  15.   *                                                                           *
  16.   * Express middleware to use for every Sails request. To add custom          *
  17.   * middleware to the mix, add a function to the middleware config object and *
  18.   * add its key to the "order" array. The $custom key is reserved for         *
  19.   * backwards-compatibility with Sails v0.9.x apps that use the               *
  20.   * `customMiddleware` config option.                                         *
  21.   *                                                                           *
  22.   ****************************************************************************/
  23.  
  24.   // middleware: {
  25.  
  26.   /***************************************************************************
  27.   *                                                                          *
  28.   * The order in which middleware should be run for HTTP request. (the Sails *
  29.   * router is invoked by the "router" middleware below.)                     *
  30.   *                                                                          *
  31.   ***************************************************************************/
  32.  
  33.     // order: [
  34.     //   'startRequestTimer',
  35.     //   'cookieParser',
  36.     //   'session',
  37.     //   'myRequestLogger',
  38.     //   'bodyParser',
  39.     //   'handleBodyParserError',
  40.     //   'compress',
  41.     //   'methodOverride',
  42.     //   'poweredBy',
  43.     //   '$custom',
  44.     //   'router',
  45.     //   'www',
  46.     //   'favicon',
  47.     //   '404',
  48.     //   '500'
  49.     // ],
  50.  
  51.   /****************************************************************************
  52.   *                                                                           *
  53.   * Example custom middleware; logs each request to the console.              *
  54.   *                                                                           *
  55.   ****************************************************************************/
  56.  
  57.     // myRequestLogger: function (req, res, next) {
  58.     //     console.log("Requested :: ", req.method, req.url);
  59.     //     return next();
  60.     // }
  61.  
  62.  
  63.   /***************************************************************************
  64.   *                                                                          *
  65.   * The body parser that will handle incoming multipart HTTP requests. By    *
  66.   * default as of v0.10, Sails uses                                          *
  67.   * [skipper](http://github.com/balderdashy/skipper). See                    *
  68.   * http://www.senchalabs.org/connect/multipart.html for other options.      *
  69.   *                                                                          *
  70.   ***************************************************************************/
  71.  
  72.     // bodyParser: require('skipper')
  73.  
  74.   // },
  75.  
  76.   /***************************************************************************
  77.   *                                                                          *
  78.   * The number of seconds to cache flat files on disk being served by        *
  79.   * Express static middleware (by default, these files are in `.tmp/public`) *
  80.   *                                                                          *
  81.   * The HTTP static cache is only active in a 'production' environment,      *
  82.   * since that's the only time Express will cache flat-files.                *
  83.   *                                                                          *
  84.   ***************************************************************************/
  85.  
  86.   // cache: 31557600000
  87. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement