2020 Node.JS Quick Upgrade Guide

1 min read Original article ↗

Jack Yeh

Bring your repository into the future in 5 easy steps.

Press enter or click to view image in full size

Photo by Ian Simmonds on Unsplash

Background

Raise your hand if you have a web service written in Node running in production from 2017 and earlier untouched.

If, like me, you have more micro-services fingers on your hands, you know that some of them are long overdue for a proper upgrade. Old repository often features the following symptoms:

  • Nested Callback/Promises everywhere
  • Ambiguous function input/output types
  • Mixed formatting and spacing, no clear structure of functionality and naming convention
  • Lackluster error logging
  • Zero reporting and monitoring support

Fear not, we know exactly the remedy for each of these symptoms, read on to see how to tackle each sections and bring your repository into the future today!

1. Nested Callbacks/Promises everywhere

Back in 2017, many popular coding libraries did not have support for Promises. We wrote code with dubious execution paths which can lead to hard to track down bugs.

Example: A route that saves a record into database and log an event to analytics.