DEV Community

Anders Hornor
Anders Hornor

Posted on

More About Node; Router() Is Pretty Dope

In an earlier post I talked about why people use Node with express and referenced some web snooping I'd done to make most of my claims. Well now I'm back with a little more meat to fatten my claims as to be honest I feel like Node has not disappointed yet. Maybe I just want to justify my time spent learning it. Anyway, Node's built-in Router Object is pretty great.

Shoutout to Udemy....and Flatiron too I guess ¯_(ツ)_/¯?

Router()™ MakesIt Simpler

One of the first web apps I made was a Ruby on Rails Single Page App(SPA)ˇ. It had a views folder that handled all my pages, then a routes.rb file that outlined all the routes. It was oddly the most frustrating part of setting up ruby apps half of the time. Its convoluted unlike a lot of other aspects of Ruby best practices in my opinion. Anyway the routes were always a hassle to set up and their order was generally an issue and it constantly felt redundant and repetitive. Well Node is less so and arguably "Super Streamlined Sawcesome....Sauce®".

  • Router turns a convoluted Routing process in Ruby into a one-stop-shop part of the function that processes the request. It turns three steps into one.

  • Router makes processing parameters a breeze. Routers Class methods include easy to use parameter management functions like express.Router().param() Also, unlike Ruby with the potential for malicious code to be passed through as parameters, Node with express's parameters are fairly secure (dont quote me on that. It's my assumption as of yet).

  • Router makes Node with express do what it was intended to do. The compartmental yet minimalistic nature of Router lends itself well to a highly scalable efficient Web App.

ˇI will literally reference this as SPA in later blog posts without defining the acronym first. Watch Out! Madman on the loose! Whaaaaaa!

| ヽ(。_°)ノ |!!!!

Top comments (0)