Experiencing Backend Development.

As a software engineer, I‘ve had to explore and dive into both areas of the stack, frontend and backend. One specific area that caught my eye was server-side development, which I will elaborate on below.

My journey started with Node.js, which is a JavaScript backend runtime environment . What makes Node.js so proficient are the features that it offers. A single-threaded model leveraging an event loop for efficient resource utilization, asynchronous programming, facilitated by callbacks, promises, and async/await, enhances performance by managing concurrent operations effectively. This architecture allows Node.js to handle numerous connections simultaneously, ideal for real-time applications. However, challenges such as JavaScript's dynamic typing leading to runtime errors exist. These issues can be handled with TypeScript adoption, by introducing an additional layer for developers to adopt.

So my next step had to be learning ExpressJS. Express is a minimalist web framework for NodeJS that simplifies the development of backend applications and APIs for web and mobile applications. Its flexibility and powerful features enable you to create robust and scalable web applications with minimal code, making it a popular choice among developers. Express is released as free and open-source software under the MIT License, making it accessible to developers.

Its features are:

Routing: Handles HTTP requests and defines responses efficiently, unlike Node.js's http.createServer.

Middlewares: Executes processes between requests and responses, with built-in middleware like express.static().

Request and Response objects: Enhances Node.js functionality with easier URL parameter access and convenient res.send()

Body Parsing: Converts client data per content type, with built-in methods like Express.json(), which is a middleware function, eliminating the need for external modules in Node.js.

However, like every other technology ExpressJS has limitations. The freedom Express provides in development can be a downside. Lack of built-in structure is vital in Express. Another downside is improperly using middleware. While middleware functions provide a powerful way to handle requests, using too many middleware functions or chaining them incorrectly can lead to performance issues and complicated code.

Due to Express not being optimized for developing large web applications, I transitioned to Nest.js. Nest.js is an open source Node.js framework. It was created by Kamil Myliwiec in 2017.

It is one of the leading and most popular TypeScript frameworks for node with 700,000 weekly download count.

NestJS TypeScript support provides strong typing, making the code more reliable. Dependency injection and a modular architecture improves the code organization and testability. The decorator-based syntax simplifies creating controllers and services. However, the framework has a steep learning curve, especially for newcomers to TypeScript or dependency injection.

Overall, my experience with NestJS has been positive. Its powerful features remarkably upgraded my productivity and code quality, making it a valuable addition to my backend development toolkit, despite the learning curve.

Ergi

Written by Ergi Lama.

Software Engineer at Honest Tech.

Want to learn more? You're welcome to contact us here!

Published on 2024-06-24.