How can I completely turn off static assets? I was thinking I might be able to do:
module.exports = {
// Init custom express middleware
express: {
customMiddleware: function (app) {
app.use(express.static(__dirname + '/some_empty_folder'));
But that doesn't seem good to me. Is there a way to turn off static asset serving in the configuration?
You can turn off serving of static assets by removing the www
middleware from the middleware.order in /config/http.js:
module.exports.http = {
middleware: {
order: [
'startRequestTimer',
'cookieParser',
'session',
'bodyParser',
'handleBodyParserError',
'compress',
'methodOverride',
'poweredBy',
'$custom',
'router',
// 'www',
'favicon',
'404',
'500'
]
}
};
You can create a sails app without front-end with the flag --no-frontend
sails new [appName] --no-frontend
This will avoid to create asset folder and grunt tasks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With