Hi I am creating a single page apps using Sails and Angular. I found the following example
https://github.com/mikedevita/sailsjs-v10-angularjs-requirejs-boilerplate
https://github.com/levid/angular-sails-socketio-mongo-demo
https://github.com/chiefy/sails-angular-yeoman-logindemo
Was it the best way to do it? What if we totally separate our Angular app from our sails REST api. And run both of them using different port. When someone will knock our server we will use Ngnix to redirect them to our Angular app and Angular will knock our REST API Sails server.
Which one would be a better practice?
I've not tested that project yet. That being said it looks pretty nice should everything work. Be warned that sails 0.10 is still in not a release (at the moment they're at rc3) so you shouldn't use it in production just now.
I've tried separating angular and sails to different servers before. It turned out to be a horrible mess, and quite painful. Issues include
Even if you were to set the sails and angular up by hand (as explained in the README.md of https://github.com/chiefy/sails-angular-yeoman-logindemo), it would be less of a struggle than using two out of the box solutions.
In practice you should use something like forever and cluster to increase performance and avoid down time (restart your server if it crashes).
Hope this helps.
Edit: Sails v0.10 has been released
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