Getting Started With Sailsjs
Sailsjs, like any web-framework has many parts. Lets get it installed to start developing with it.#code , #sailsjs , #nodejs
Here in this post, I explain installing Nodejs and Sailsjs on a local machine–desktop or a laptop. In another post, I will cover, how to install on a server like webfaction[^1].
If you want a quick start, then download binaries for your OS from nodejs homepage. Ensure you install npm along with node as npm is a critical component to get any development in nodejs.
For step-by-step instructions for all OSes, refer Mathew Nuzum’s post.
Installing a Virtual Environment
From time to time, you would want to experiment with a beta version of Sailsjs or even Nodejs. But you don’t want to disturb your main installation. Someother times, you may work on client projects each requiring different versions of Node or Sails. Virtual Environment is your answer for such scenarios.
My choice of VE is nave. You can install it like any other installation of node modules, which is
npm install -g nave
Once installed, you can install specific node versions and name your environments too:
nave use myenvironment stable
Here ‘myenvironment’ is the environment name and it will use the latest stable version of nodejs. You can test your new virtual environment by following commands:
nave use myenvironment which node
which should give something like
(Output will differ on Windows and Linux)
Once you have gotten node and nave installed, it is time to install sails. For this purpose, I’m going with the latest beta version of sails.
nave use myenvironment npm install [email protected] -g
Depending on your network bandwidth, it will take sometime to install all the components of Sailsjs. Once installed you can check your sails installation:
This should give you something like:
You are now ready to write your first Sailsjs application.
[^1]: All links to webfaction are affiliate links