Trying out Sails.js
Posted: Wed Sep 25, 2013 9:03 pm
I am not sure how many of you have heard of Sails.js, which is an MVC framework for Node.js. "So what?" you might be saying. Well, there are a few things that make me very excited about Sails, and have me, at least on the outset, thinking that this could be the node framework I have been looking for. Express is cool and all, but it is very low-tech. Feature-wise, it just doesn't hold a candle to some of the big players on other platforms such as Rails, ASP.NET MVC, Laravel, Symfony, etc. Express is essentially a bare-bones web framework that looks a bit like an MVC framework. Where Express shines though is when others build onto its foundation to create something larger, in the exact same way that Express built on Connect. That is the case with Sails, where it has been built on the rock-solid foundation of Express and Connect, but it adds tons more features.
Some of the features in Sails that excite me:
1. It is built from the ground up to work with Socket.io. Getting Socket.io and Express to work together feels like pulling teeth. You basically have to make 2 separate sections of your program (one for HTTP, and one for Socket.io) and share functionality and data between them, with objects, setting socket nicknames, etc. Sails can funnel both HTTP and WebSocket requests to the same controllers, allowing you to structure real-time web applications almost as though there is no Socket.io. Security and access are automatically shared between Socket.io and Sails
2. Sails has a true ORM built in (called Waterline) that works well with both NoSQL and SQL databases using the same API.
3. You get a REST-based interface for free when you create a controller.
4. Built-in membership and roles. Instead of having to start from scratch every time to make a login system, you only have to customize what is there! This is a feature that has become fairly common place in modern MVC frameworks, but was sorely missing from most of the node frameworks out there.
5. It uses Grunt natively to automatically LESS compile, concatenate your client-side scripts, work with templates and more.
...and plenty of other stuff. But for me, #1 makes it more than worth a look. As easy as node and Socket.io make real-time web development, it was not perfect with the jagged edges of the two different technologies not coming together smoothly. This could make real-time web development a complete snap!
I will let you know how it turns out, but I am really liking it so far
Some of the features in Sails that excite me:
1. It is built from the ground up to work with Socket.io. Getting Socket.io and Express to work together feels like pulling teeth. You basically have to make 2 separate sections of your program (one for HTTP, and one for Socket.io) and share functionality and data between them, with objects, setting socket nicknames, etc. Sails can funnel both HTTP and WebSocket requests to the same controllers, allowing you to structure real-time web applications almost as though there is no Socket.io. Security and access are automatically shared between Socket.io and Sails
2. Sails has a true ORM built in (called Waterline) that works well with both NoSQL and SQL databases using the same API.
3. You get a REST-based interface for free when you create a controller.
4. Built-in membership and roles. Instead of having to start from scratch every time to make a login system, you only have to customize what is there! This is a feature that has become fairly common place in modern MVC frameworks, but was sorely missing from most of the node frameworks out there.
5. It uses Grunt natively to automatically LESS compile, concatenate your client-side scripts, work with templates and more.
...and plenty of other stuff. But for me, #1 makes it more than worth a look. As easy as node and Socket.io make real-time web development, it was not perfect with the jagged edges of the two different technologies not coming together smoothly. This could make real-time web development a complete snap!
I will let you know how it turns out, but I am really liking it so far