Web Applications: An introduction to Nest.js

For Web applications with Node.js the Framework Express is the top dog. A welcome change is Nest.js, which brings modern development patterns to the server world.

Web Applications: An introduction to Nest.js
Web Applications: An introduction to Nest.js

Node.js has enjoyed increasing popularity in web development for several years. Based on the JavaScript platform, numerous development tools and backends for web applications are created. However, there is a big point of criticism when it comes to using web application frameworks like Express: the missing architecture.

Although these frameworks provide many features and a plug-in system that developers can use to load additional extensions to simplify their work. However, Express and Co. do not specify how the individual components of an application work together or how the framework groups them together.

Read More Stories: Chris Hughes, co-founder of Facebook: “It’s time to break Facebook”

This tries to solve a relatively young project. We’re talking about Nest, a framework for Node.js to build back-ends for web applications. Nest’s goal is to increase development efficiency. For this purpose, the framework makes use of established as well as new features of the JavaScript world.

Nest: Different from the others?

Nest developers have combined the strengths of various JavaScript frameworks and libraries into a new contemporary framework. Developers who have worked with the Angular front-end framework recognize many patterns – the nest makers are calling the framework a great inspiration. But how can architecture and design patterns be transferred from the frontend to the backend?

Read More Stories: bloxberg: New blockchain research project for scientists

The basis of Nest is not JavaScript, but the Superset TypeScript. The entire framework is written in TypeScript and is thus in good company. Both Angular and the planned for 2019 version 3 of the framework Vue.js are developed in TypeScript.

Developers on Facebook are increasingly flirting with TypeScript: This shows the support of TypeScript in Create React App or the fact that the test framework Jest has been ported to TypeScript.

Read More Stories: Secret service in the anonymization network: CIA website now accessible via Tor

Nest also takes a modular approach. Not only is it noticeable when setting up an application when developers can divide it into loosely coupled modules, but also at the core of the framework, where users can swap the underlying application framework if necessary.

In the basic set-up Nest follows proven paths, but modernizes them in some cases considerably. This preserves Express’s usual routing. Nest does not configure the routes in the source code, but annotates them using TypeScript Decorator.

Read More Stories: Developer Search Engines: Elastic Introduces Beta to the New Enterprise Search

In general, Nest uses the Angular-known decorators quite intensively. The functions behind the individual routes are organized in controller methods. They should take care of extracting information from the incoming request and generating a response to the client.

The business logic of the application is in separate service classes, which developers can load via Dependency Injection. Access to data sources such as databases or web services can be encapsulated by users, much like business logic. The integration of a database abstraction layer is also possible in just a few steps.

Read More Stories: VPN : First trial version of Wireguard for Windows available

Thus, the goal of having the standard elements of a web backend running in a short time has come within reach of Nest. They form the basis for a modular application with a focus on good maintainability and extensibility. To minimize the boilerplate code that must be written for an application by hand, Nest provides a command-line interface that accompanies the application throughout its lifecycle.

Read More Stories: Deepdotweb: Darknet directory down, arrested operators