Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on rails and Node.js

I am wondering how to integrate node.js on a rails app (for learning purpose).

Based on Michael Hartl tutorial (http://railstutorial.org/) I realized a basic twitter clone with rails and want to get user microposts in real-time without the use of comet or juggernaut. (the application is hosted on heroku)

For the moment, I only see example with node.js frameworks (http://howtonode.org/grasshopper-shoutbox) but nothing merged with a ruby on rails app. I would be very thankful if someone knows a good tutorial or give me some points to start in order to accomplish this.

Thanks!

like image 580
user425891 Avatar asked Aug 20 '10 01:08

user425891


People also ask

Does Ruby on Rails use node JS?

Contrary to Node. js, Ruby on Rails is a framework created to make the development process faster and easier without bottlenecks within the processes. The framework is written in Ruby, which is a multi-purpose language.

Is Ruby on Rails better than Nodejs?

Node. js takes more time, as you need to find the modules and follow the instruction for integrating them. Ruby on Rails seems to be faster, as you can perform some task, like database migration, with just a few commands. The learning curve is partially less than with Rails.

Is Ruby on Rails easier than node?

4. Development Time Ruby on Rails also wins when it comes to development times. The web app development framework consists of an integrated webserver. Moreover, it consists of a large library of scripts and generators. As a result, website development is much easier with Ruby on Rails as compared to Node.

Which is better Ruby on Rails or JavaScript?

JavaScript is perfect for developing low-latency applications as you do not need to wait for the completion of functions. Ruby on Rails doesn't fully support asynchronous code and has a slow CPU processing time.


1 Answers

As Shripad said, I'd consider trying to build your app with Node by itself. Geddy will feel familiar (getting started anyway) if you have experience with Rails. Note: I do not have experience on a real world app with Geddy, but it is the best Rails-like framework I've seen so far. For persistence you can use SQLite, PostgreSQL or CouchDB, just like you would with Rails. I thought about how to communicate between a Rails app and Node without any intermediary. In our work project we're using Redis as an intermediary between Rails and Node. Rails publishes messages to Redis, Node pulls messages from Redis. I could not find a good way or example projects to avoid the middle communication layer on a personal project, so I went with the same setup. The good news is Node Redis modules are written and once you get everything installed, it is easy to test out pushing messages back and forth.

like image 168
Andy Atkinson Avatar answered Sep 19 '22 00:09

Andy Atkinson