3 ms·
I've used sails in production on a couple of apps and it's mostly pretty good but there are a couple of annoyances that will inevitably get ironed out as it dev
by campbellmorgan 12y ago
I've used sails in production on a couple of apps and it's mostly pretty good but there are a couple of annoyances that will inevitably get ironed out as it develops. For me the most irritating thing is being unable to write good unit tests for controllers that use models as sails models are scoped globally and controllers have to be objects which makes injecting mocks difficult. It's great for getting a prototype up and running quickly, but if you're planning on building a big production app, a better longer term strategy would be building an express app from good open source components. (ie using sequelize for ORM). As has been mentioned elsewhere the documentation isn't always consistent and you sometimes find that a waterline function in the documentation has been deprecated in the current stable version, so be prepared to get to know the source well. In any case, it's a great effort and is a great time-saver on getting something live quickly.
- Bahamut 12y agoWhy not place the model usage in services and use the services in the controllers?
- campbellmorgan 12y agoWhile that is a nice separation of concerns (Angular-style), it doesn't solve the problem for unit testing the controller because you still won't be able to inject a mock service into the controller without some beforeEach global variable hackery.