2015-08-18 44 views
2

我讀到這個不是很新的post關於禁用sails.js中的一些東西。具體而言,我想嘗試的是禁用etags。sails.js:如何禁用etags

有誰知道如何禁用sails.js(0.11.0)?

+1

[試試這個(http://stackoverflow.com/questions/25179341/sails-js-v-10-2-missing-express-app)訪問快速應用程序。它應該是'sails.hooks.http.app.disable('etag')' –

+0

@ AlexisN-o:這種初始化應該放在哪裏? – tokosh

回答

4

你可以在the bootstap.js file禁用它:

// config/bootstrap.js 
module.exports.bootstrap = function(cb) { 

    // Add this line to access to the Express app and disable etags 
    sails.hooks.http.app.disable('etag'); 

    // It's very important to trigger this callback method when you are finished 
    // with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap) 
    cb(); 
};