arrow-left Back to Blog

Get acquainted with Sails.js


Main image of the post

Sails.js is framework that allows to quickly assemble custom applications of node.js on using MVC pattern with easily maintained code. Sails.js has specific difference from many other frameworks on MVC base – it allows to use almost any database for Sails.js includes different adapters. In my opinion it is very interesting framework. Sometimes, programmers have to perform routine work, such as creating a project (some basic architecture), adding settings to build Grunt project, creating minimal functionality for work with the REST API and I think there must be some solution, how to escape this work so I found node framework Sails.js. After learning about it, I decided to create my first simple application on Sails.js and it happened pretty quickly, easily and the main is that it was intuitively understandable.

Installation and use of this framework was understandable to me, since I used different documentation, which was written by the developers of Sails.js very good. All the actions of installation and use of interesting framework were described in detail. They’ve described not only actions, but even every step. It took me 10 minutes to install and run the project on Sails.js. The framework didn’t cause any problems with the installation and connection and as everyone knows the problems with implementation of something new in the project, it can be caused by a bunch of the errors and a large amount of time on connecting the framework.

The obvious and huge plus of working with this technology, for me was the REST API. It seems that there is nothing special in it, because in Express and other frameworks of node they also can use REST, but there is one big BUT. Others allow you to create REST, and Sails.js generates itself based on models. In order to generate a CRUD you need to create a controller with the command:

sails generate controller name_controller

Then create the model with the command:

sails generate model name_model name_field : type

Then create an API complex - consisting of the already created model and controller, which I will call create_api. To create the API I will enter the following command:

sails generate api create_api

The generated files will be located in the same directory folders api /, Sails creates a CRUD API by default ready for use.

I can’t but mention, that the grunt file and package.json appeared automatically with the prepared code, when connecting Sails.js.

In general, I can say that when I was working with Sails.js everything was intuitively clear to me. I would recommend you to work with this quite interesting and young framework.

Share

Read more

Contact us

Send us a few words about your project

+31 641039634 team@mifort.org

Netherlands, Amsterdam, 74-2 Albert Cuypstraat

View on map

Belarus, Minsk, Romanovskaya Sloboda 5

View on map