Sailsjs - Better Nodejs Framework

Node.js or Node, is a JavaScript platform built on Chrome’s Javascript runtime to build large scale web and network applications. It uses an event-driven, non-bloking I/O model so it is very lightweight, fast and perfect for data-intensive real-time applications which can run across multiple distributed devices.

Web Framework For Node

Web Framework helps people in creating applications by providing functionality in easy way so than user don’t have to do a lot of unnecessary work. Using framework, user can focus more on application rather than on understanding core of the platform. i.e. a web framework is an easy wrapper that also helps community to interact with each other for better functionality and availability of the itself.

Below are some popular node frameworks.

  1. Express – node.js web application framework

    Express is the most popular framework for node that is used by established brands such as Countly, MySpace, Storify etc. The blogging platform ‘Ghost’ was also made on top of Express framework. It can be used for small to large and hybrid real-time applications without any external templates.

  2. Meteor.js

    Meteor is like ‘Rails is to Ruby” for Node. Meteor is very infant and may have some bugs but it’s a very opinionated framework that uses node on the server for low-level functions for sending and receiving HTTP request and doing I/O operation. It comes with a handlebars template.

  3. Restify – building REST APis with Node.js

    This framework is very useful and easy to use if you want to create REST API for your applications.

  4. Sails.js | Realtime MVC Framework for Node.js

    I love Sails.js which is very easy to build enterprise-grade and production-ready Node.js apps. If you have good background on Ruby on Rails, then it will not be hard to understand Sails which is very similar to the MVC pattern of Ruby on Rails. Additionally it also supports more features for the requirements of modern apps like scalable data-driven APIs and service-oriented architecture which is perfect for building chat, realtime dashboards or multiplayer games.

Why I like Sails

  1. Permission Policies
    Sails use separate files for different permission policies. This makes permission policies separated from controllers which make sense and easy to work with.

  2. Sails uses blueprints
    Sails has CRUD blueprints and REST endpionts like http://localhost:1337/:controller/:action/:id for the default route for controller. Custom route can also be defined in config/routes.js.

  3. Object Relational Mapping
    Sails provides an ORM (Object Relational Mapping) called Waterline. This normalize interactions with models so that any data source can be used which makes easy to define an interface for mapping custom models for external APIs, multiple databases or in-memory storage i.e. session storage.

  4. Sails uses Express
    If you know Express and don’t want to leave it, then Sails.js is for you because any express functionality can be used with sails easily.

  5. Easy to start
    Getting started with sails.js is much quicker and easier as you run “sails new project1” to create the application skeleton named project1. Then add controller and model for some data by running “sails generate modelname” from command line.

Some bad about sails.js

  1. As Sails is a new infant framework, there are difficulties to find solutions to specific problems related to sails because a few users are using it and not much resources available on forums and websites like stackoverflow.com.
  2. Sails has no testing strategy or tools for testing it’s applications. If i want to test some mission-critical parts of app, then it’s difficult to do it because there is no documentation or guidance for it.
  3. “sails lift” command take more time to start up than just calling “node app”. Each time the code is changed, the sails lift command have to call for updating the change which makes app development slower.

For more, visit Sails.js