Not all tools are good. You need to know what your tools are, what they do and how to avoid shits (tools always come with shits… just jump over, not into). Mongoid is recommended in MongoDB official site as the first choice for ruby ORM to work with Mongodb… But is it good enough ? In my […]
Tag Archives: ROR
Okie !! I have come back with tons of problems with Mongoid… Please refer to my previous post at Part 1 Example 3: can not save your Array field in mongoid. Sample Model Okie… Let’s write some code. And … We got So watafak happened? Let’s look back at the post.tags << tag command. We […]
Capistrano is a Ruby-based server automaton and deployment tool that is primarily designed to deploy Ruby (on Rails) applications, but also works really well for deploying Node.js applications because of its sensible defaults.
I’m not going to explain exactly how Capistrano works, instead I’m just going to describe my Capistrano configuration for a simple Node.js application. To get started with Capistrano read through the documentation on their website and follow the instructions to set up Capistrano in your project.
Over the past few weeks I have created a few Node.js web apps (such as Bourbon Tweet Alerts) and I’ve noticed that there is a huge inconsistency in building Node.js web apps. I desperately needed a way to consistently build projects the same way every time. As we all know, there’s nothing like having to figure out how someone made a piece of code function, much less an entire framework! I’ve been working with Ruby on Rails for a while, so making a transition into Node.js was quite a different leap. The one great thing I like about Rails is standardization. When you create a new rails app, the MVC architecture is templated out for you (ie “batteries included”). Node.js on the other hand, allows you to pick and choose any libraries you want to make the project successful. I’ve read over countless blogs and not a single one covers everything you need to know how to build a CRUD + REST application from soup to nuts. So I must thank about 20 different blogs and loads of github README’s to help assemble this beacon of guidance.
I’ll admit it, I’m a sucker for simple generation of skeleton. That’s why I loved using rails. The entire MVC structure is laid out for me and I can be on my way.
Sails.js makes it easy to build custom, enterprise-grade Node.js apps. It is designed to mimic the MVC pattern of frameworks like Ruby on Rails, but with support for the requirements of modern apps: data-driven APIs with scalable, service-oriented architecture. It’s especially good for building chat, realtime dashboards, or multiplayer games.
In other words: Sails.js allows you to easily create apps with Node.js using the Model-View-Controller pattern to organize your code so it is easier to maintain. Sails.js provides various commands to automate the creation of models and controllers, saving you time and allowing you to create the app faster. (Views have to be created manually in the /views directory in the template /views/:controller/:method.ejs). You are able to use various templating languages, however EJS is the default, and it would be safest and easiest to just stick with EJS.
Sails.js also has various “adapters”, allowing you to use virtually any database you want to with your app. This gives you the maximum amount of flexibility, differing from other MVC frameworks that insist on you using MongoDB.
All of these and the fact that on deployment, all of your files are concatenated and minified means that you don’t have to spend as much time setting the main framework up to build your app on top of, as it is all ready and easy to use.