2015-08-18 31 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(); 
};