This is the first tutorial on creating an application with Sails JS and Angular JS. So let us get into the topic . There are two big things which we should notice . We have selected Sails as well as Angular, why? This will be briefed in coming tutorials :) .
A small intro about SailsJS
You might be familiar with web development in PHP , ASP.Net etc. What makes it different to create an application on Sails ? Sails is one among the most powerful
Waterline, which provides a simple data access layer that just works, no matter what database you’re using.
Something about Angular
Angular JS is a super heoric MVC framework created and maintained by Google . Angular has powerful UI bindings which allows synchronisation among models and views.
$http is used to communicate with
In this tutorial we will create a basic Sails application .A basic Angular app and communication between these two will be handled in next tutorials.
Create a Sails Application
- You should have `NodeJs` installed on your computer inorder to begin.
- You should have the latest version of Sails installed.
To install Sails
To know more go to http://beta.sailsjs.org/#/getStarted
I’m using latest version of Sails 0.10.0-rc8 . It will take some time to complete the process . After installation , try following commands to create a sails application
This would generate a message
An application name ‘app’ is created by now. Open you app directory – cd app. To
lift the application try the command
The above screen would be the result . There are some points to be noted here . The default port for a sails application is
1337 and the environment by default will be development .
Try hitting your browser at
You will get a page like this
To change the default port in Sails , you have to change the local.js file in locales folder . App –
config/locales/local.js In that you will find
change it to
Save the file and try
lifting the app now the app will be lifted in given port address.In production, you’ll probably want to change this setting to 80 (http://) or 443 (https://) if you have an SSL certificate. By now you know how to create a basic Sails application . Generating apis using the Sails app will be handled in the next tutorial . See you there bye :)