ExpressoTS is a lightweight framework for building scalable, readable and maintainable server-side applications in TypeScript.
📄️ First Steps
In this section, you will delve into the core concepts of ExpressoTS to familiarize yourself with the framework and its building blocks.
The Application Overview provides a comprehensive demonstration of the main components of an ExpressoTS application. At the heart of an ExpressoTS application lies the Application class. It serves as the foundation for creating and configuring the server. Additionally, the Application class makes use of the application container from Inversify that loads all the modules, including their respective routes [controllers]. This ensures a streamlined and efficient process for handling incoming requests and delivering the appropriate responses.
📄️ App Container
The ExpressoTS uses InversifyJS as its IoC (Inversion of Control) container. InversifyJS is a powerful tool for managing dependency injection. It is a type-aware container that can be used to manage the instantiation and resolution of objects, as well as the management of their life cycles.
A module or container module is a collection of services, in our case more specifically Controllers and their dependencies that can be registered and resolved by ExpressoTS custom InversifyJS container wrapper.
Controllers act as the primary interface between the client and server in ExpressoTS applications. They handle incoming requests, validate payloads against an input DTO, and emit responses in the DTO pattern. In essence, controllers bridge the communication between clients and service layers, also known as use-cases.
📄️ Use Cases
From a UML standpoint, use cases provide a way to model the interactions between users, other systems, and a software application. A use case describes a specific scenario or flow of events between the actors and the system, leading to a certain outcome.
From the perspective of the ExpressoTS Architecture, Providers are responsible for supplying data and/or mechanics to the application, abstracting the details of how the data/mechanic is actually implemented. This abstraction aligned with the Dependency Injection Container enables the developer to easily switch between different data sources/providers without affecting the other parts of the application as they are decoupled.
In ExpressoTS, a repository class typically includes methods such as create, update, find, findOne, and delete, which correspond to common CRUD (Create, Read, Update, Delete) operations on the data store. These methods can be implemented using a database library or ORM (Object-Relational Mapping) tool such as TypeORM, Prisma, Sequelize, etc.
Entities are the core components of an ExpressoTS application. They are the objects that are used to represent the data that is going to be manipulated by the application.
Here is a complete list of all decorators available in ExpressoTS as well as a brief description of what they do.
📄️ Dependency Injection
Dependency Injection (DI) is a design pattern used in software development that involves providing an object with the instances of the classes it needs to perform its tasks, rather than having it construct these instances itself. This process of providing instances is called injecting them, hence the term Dependency Injection.
The purpose of this section is to list all dependencies used by ExpressoTS and our vision about dependency management.
📄️ Status Code
Status code is a way to represent the result of a request. These HTTP responses indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes:
📄️ Error Handling
When it comes to error handling in Node.js TypeScript APIs, there are several best practices and approaches you can follow. ExpressoTS provides a simple and easy way to handle errors.
Unit testing and integration testing are both important in any application development process because they serve different purposes.
Express.js offers a render method to render a view and send the rendered HTML string to the client.