The rest should mostly be copy-and-pastable.
What is Sails.js?
Sails.js makes it easy to build custom, enterprise-grade Node.js apps. It is designed to mimic the MVC pattern of frameworks like Ruby on Rails, but with support for the requirements of modern apps: data-driven APIs with scalable, service-oriented architecture. It's especially good for building chat, realtime dashboards, or multiplayer games.
In other words: Sails.js allows you to easily create apps with Node.js using the Model-View-Controller pattern to organize your code so it is easier to maintain. Sails.js provides various commands to automate the creation of models and controllers, saving you time and allowing you to create the app faster. (Views have to be created manually in the /views directory in the template /views/:controller/:method.ejs). You are able to use various templating languages, however EJS is the default, and it would be safest and easiest to just stick with EJS.
Sails.js also has various "adapters", allowing you to use virtually any database you want to with your app. This gives you the maximum amount of flexibility, differing from other MVC frameworks that insist on you using MongoDB.
All of these and the fact that on deployment, all of your files are concatenated and minified means that you don't have to spend as much time setting the main framework up to build your app on top of, as it is all ready and easy to use.
Installing Node.js on an Ubuntu VPS
Installing the pre-requisites:
sudo apt-get install python-software-properties python g++ make
If you are using Ubuntu 12.10, you will need to do the following as well:
sudo apt-get install software-properties-common
Add the PPA Repository, which is recommended by Joyent (the maintainers of Node.js):
sudo add-apt-repository ppa:chris-lea/node.js
Update the package list:
sudo apt-get update
sudo apt-get install nodejs
To install the latest stable release of sails, you will need to run:
sudo npm install sails -g
-g flag ensures that sails is installed globally and can be used as a command-line tool.
Creating your Sails app
You will want to navigate to the directory in which you would like your app to be located, e.g.
/var/www and then run:
sails new project-name
This will add the required files to your project, and create a directory named project-name.
Starting up the Sails.js server
To view your boilerplate app, you will need to change directory into the project directory and then start the server:
This will create a server running at 123.456.78.90:1337, and the page may look something like this (They have changed it a few times, so depending on when you are reading this article, it may be different):
Creating a controller is easy, the sails CLI does all the hard stuff for you. e.g. To create a controller called user with the methods "index, show, edit, delete", all you have to do is run the following command:
sails generate controller user index show edit delete