I'm developing a REST API backend application using Sails.js 0.10
as a framework. This application will be strictly REST, authentication will be implemented using oAuth bearer tokens. All responses will be in JSON format.
Considering this specific requirements I do not need some functionality embedded into Sails.js and I want to remove it from my application (so it will run faster without extraneous code).
So, my question is: How do I disable the following built-in functionality?
What else can be disabled that is not required in my use case?
The documentation is kinda fragmented on this specific question. All configuration options are described for each module, but there is no information of how such a module can be disabled and/or removed from the application.
Hardcore! You'll need to disable several hooks, and also some middleware. First, in your .sailsrc
file, set:
"hooks": {
"session": false,
"sockets": false,
"pubsub": false,
"views": false,
"csrf": false,
"i18n": false,
"blueprints": false
}
Then in your config/https.js
:
middleware: {
order: [
'startRequestTimer',
// 'cookieParser',
// 'session',
'bodyParser',
'handleBodyParserError',
'compress',
'methodOverride',
'poweredBy',
'$custom',
'router',
// 'www',
// 'favicon',
'404',
'500'
]
}
That should get you on your way.
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