Joseph Jude

Technology, Psychology, and Story Telling

Getting Started With Sailsjs

Posted: Tags: code,sailsjs,nodejs

Sailsjs is a web-framework built on top of Nodejs. Like any web-framework, it has many parts. But node package manager, aka npm, simplifies installation of nodejs components.

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].

Installing Nodejs

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.

If you want a geeky start, install nodejs via homebrew, Mac's package manager.

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

/Users/jdee/.nave/installed/myenvironment/bin/node

(Output will differ on Windows and Linux)

Install Sailsjs

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:

which sails

This should give you something like:

/Users/jdee/.nave/installed/myenvironment/bin/sails

You are now ready to write your first Sailsjs application.


  1. All links to webfaction are affiliate links



Like the post? Retweet it. Got comments? Reply.

Comments

comments powered by Disqus