Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails or node.js for Restful API

I have an existing website written in ASP.net, I have recently switched to Mac full time (With Windows in Boot Camp), and need to write a public API for accessing my website's MySQL data. I primarily want to use the API to allow building an iOS application.

I am interested in learning either Ruby on Rails or Node.js, I haven't used either of them yet.

Which language would be better for me to learn?

like image 318
spaetzel Avatar asked Dec 05 '22 19:12

spaetzel


1 Answers

Rails is a relatively mature web framework based in Ruby and is designed for handling object-mapped data persistence in a relational database backend.

Node.js is much newer on the scene, and unlike Rails, is a more bare-bones package that allows for server-side Javascript applications thanks to a pretty tight HTTP(S) API. Node applications are by nature event-driven, which may or may not be ideal for your application.

Since it seems that you'll need data-persistence (you mentioned accessing MySQL data...), Rails might be easier to get started with, as it comes packaged with all the things you need in this respect and is designed to facilitate this sort of application.

If you you don't really need relational data persistence, Node is probably a better bet as it stays out of your way and lets you decide how to handle things. It's important to note that Node is a much more bare-bones "framework" than Rails -- if you want something slightly higher-level but still lighter than Rails that runs on Node, express is good place to start.

Still, if you want to try Node (I will confess: it's a lot of fun!), it's totally possible to access MySQL in a nice, event-driven (non-blocking) way. Here are two modules that will be helpful:

  • node-dbslayer
  • node-mysql
like image 126
namuol Avatar answered Dec 10 '22 11:12

namuol