Clean and Consistent Express.js Controllers – Enterprise Node.js and TypeScript

Clean and Consistent Express.js Controllers – Enterprise Node.js and TypeScript

In this article, we explore how to structure a clean and consistent Express.js controller by using abstraction and encapsulation with TypeScript. Because there’s a lack of opinion around how Express.js controllers and routes should be setup, it’s easy to end up writing code that’s not very DRY and not very consistent. Now you know my preferred way to create Express.js controllers by encapsulating all of the common functionality in an abstract class.

Source: khalilstemmler.com