DEV Community

Swislok-Dev
Swislok-Dev

Posted on

Rails or Express?

Ruby on Rails and Express.js are a couple of popular choices for developing a backend for web apps and both have their strengths and weaknesses.

Ruby on Rails

For my bootcamp we were taught Ruby/Rails and how to create a working web application with either the use of a frontend framework (React, Vue, etc.) or use the built-in MVC that Rails comes packed with.

Rails is fully featured and comes with about every tool one would need to get deployed and has it's own Gemfile with some common packages left in comments in case it will be needed, bcrypt is the one that comes to mind first. A lot of the building of the source is opinionated and is fairly easy for any other developer to go through the code and collect the objective for the backend purpose.

Along with all that it's packed with, Rails has the ability for ease of setup, such as an API flag, templating, or initializing the SQL database for the project (postgresql, mySQL).

Express

Express was the first technology I went looking into after graduating since most employers and looking for experience using Node.js or worked with MERN/MEAN stack.

Upon following a short tutorial on doing to reading how express works and how it makes the life of the developer easier by cutting the amount of lines to get a server up and running. While Express is not as feature packed as Rails is, installing packages becomes fairly routine with any Node/JavaScript project and nearly goes overlooked after the 100+ time of using npm install.

While having a Node server using the Express framework as the backbone, there is a bit of freedom I felt while writing a backend. When writing the MVC, aside from React handling the views, it was nice have a shorter file structure all while having the functionality that I required the same as a Rails app.

Conclusion

While a closer comparison with Sinatra might be more appropriate, my choices for backends, at the current time, is between Rails or Express.

As such, Rails is feature rich which is both good getting a web application up and running and bad for it having all the packages which can make it slow to work with.

Express is the lightweight option which will be faster to run and becomes more customizable, but will inevitably take more lines of code to create the same level of functionality as the Rails server would be able to do.

Top comments (0)