I recently came across sails.js and loved it (so still a newbie). My question related to deployment of me webservices and the UI.
My application will have a web UI as well as mobile UI and I have chosen the following: Web UI - AngularJS + bootstrap Mobile UI - AngularJS + bootstrap + cordova (for native API access)
I want to maintain common code across my web UI and mobile UI. So the options I have is to host sails.js as only a webservices API server and host the UI in separate server (like nginx / apache). I will have to do some selective separation of code (esp. landing page + native layer access).
What are the pros/cons of this approach? Any experiences, inputs would be greatly helpful.
Not sure if I understood correctly your question but I think you are overcomplicating. Here is my take:
You don't really need to separate the API and the webapp itself. You can just put Sails running on a specific port (1337 is the default) and Nginx in front as reverse proxy, forwarding the connections to sails and serving the static files that conform your UI (JS, CSS, Fonts, etc).
Here's and example for configuring Nginx and a node app with this setup.
You've got basically two options:
A - RESPONSIVE DESIGN WEBAPP
A responsive Sails webapp with Bootstrap or Foundation allows you to share 100% of the UI. You serve the compiled and minified statics from your webserver Nginx (or better from a CDN) with all the Angular logic, styles, etc
Browsers and mobiles connect to your Sails API (i.e: yourdomain.com/api/v1/)
B - WEBAPP + CORDOVA MOBILE NATIVE APP
If you go with cordova cos you need native access, the UI files are also native to the device.. You're sharing some logic but little UI (unless you already have a Responsive Design in the webapp and borrow code from it).
In this case you could mantain a series of css and angular modules in a separated repo that is shared among both UI's and load it via git submodule or similar. But I would (personally) prefer separated codebases or a responsive webapp. It all depends on how big your app's codebase grows.
Webapp and cordova app still connect to your Sails API (i.e: yourdomain.com/api/v1/)
Hope it helps