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?
- Blueprints
- Static
- Cookies
- Sessions
- Views
- WebSocket
- CSRF
- i18n
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.
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?
- Blueprints
- Static
- Cookies
- Sessions
- Views
- WebSocket
- CSRF
- i18n
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.
Share Improve this question edited Jan 19, 2015 at 17:25 Slava Fomin II asked Jan 18, 2015 at 23:09 Slava Fomin IISlava Fomin II 28.7k34 gold badges134 silver badges208 bronze badges1 Answer
Reset to default 18Hardcore! 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',
'press',
'methodOverride',
'poweredBy',
'$custom',
'router',
// 'www',
// 'favicon',
'404',
'500'
]
}
That should get you on your way.