Choosing a Backend, Express or Rails?
With the advent of our final projects approaching, I’m starting to do some research in some of the tools, frameworks, and libraries I’d like to use. At Flatiron School, most of our projects rely on a Ruby on Rails backend, but at several science fairs, where the graduating students demo their final projects, I have heard several of them mention that they used Node.js or Express. With most of my experience coming from Rails, I decided to look at the differences between the two frameworks.
Some interesting Facts about Express.js:
- Originally created by TJ Holowaychuk
- Inspired by Sinatra
- Backend part of the MEAN stack (MongoDB, Express, AngularJS, Node)
I am going to bullet some differences between the two, and point out which one I like better, these comparisons are my personal opinion based on my style and experience.
- Rails has more “magic” out of the box, including its ability to create migrations
- Express has less features out of the box, but is easily and highly customizable with the right packages.
- Rails is highly structured, or highly “opinionated”, which means if you don’t do something that follow conventions it will break. It is also easy to pass projects from developer to developer because the conventions are rigid and easier to follow.
- Express on the other hand has no naming conventions and is more free form, which seems interesting at first, but with less conventions to guide you can quickly become unorganized, however that tends to mean Express directories are generally smaller than Rails directories.
- Express is faster than Rails probably because of its ability to process asynchronous I/O calls
- However, tasks that entail more cpu intensive requirements generally perform better with Rails
- Rails(2004) is way older than Node(2010), which means more gems have been developed for it, and the conventions and best practices are more fully flushed out.
- Express while newer and fresher, develops packages faster which can lead to instability as there are tend to be multiple packages for similar requirements.
Both Rails and Express have their advantages. Rails is more structured, but slower, and “less sexy.” While Express is the new kid on the block, faster, but also more freeform. Based on my experience with Rails and my research in Express, I think I would prefer Rails over Express, simply because as an inexperienced developer the conventions and rigidity of Rails seems safer and more comfortable. However, if I do appreciate the creativity and efficiency provided by Express.
Picking the right framework for your next web app can be a daunting task. We discuss the pros and cons of using Ruby on…echo5web.com