Express.js isn't so bad

Mar 22, 2019 · 219 words · 2 minutes read apiexpress.jsjavascriptnodeprogramming languages

I usually shy away from JavaScript unless I’m writing front-end code – I typically write my RESTful APIs in Python using Flask. I’ve written APIs in other languages too – R using Plumber, Julia using Genie.jl, and C# using RestSharp – but this was my first go at writing one in JavaScript so I thought I’d summarize my thoughts about it.

The real motivator to write an API in JavaScript was because I wanted to re-use some code my coworker wrote in Node. Not really being a Node developer I had to do a quick Google search to figure out which module I should be using for my API. One of the reasons I tend to avoid JavaScript for somethings is that things tend to move quickly and just when I start to figure out the latest Node package it seems there’s a new one everyone else is already using. In this case Express.js was near the top of the search results and I recognized the name, so I knew it must be stable enough to at least give it a try.

Using Express.js reminded me a lot of Genie.jl and I enjoyed the sense of familiarity. This was a small API so I was actually able to write the entire thing in less than 30 lines of code.